In part 1th of this three-part series, the key features of open source technologies such as Firefox, Zend Core, and MySQL are understood. We discussed a more complex banking scenario that spans all three tiers of an Ajax application. It also sets up the database servers, middle-tier servers, and Eclipse-based Ides needed to develop an end-to-end Ajax application. In part 2nd of this series, some parts of the bank scenario will be developed. Specifically, a back-end database will be created using the MySQL database. We'll look at several MySQL command-line tools and use these tools to connect to the database, create, define, and populate bank-related data in the database. Then, develop a middle-tier PHP module to provide the bank's business logic, which uses ODBC to connect to the MySQL database. Finally, develop a banking portal that allows users to interact with this end-to-end application through this simple browser user interface, which will soon run on Zend Core.
Brief introduction
As pointed out in part 1th, this banking scenario mainly provides basic services performed by bank tellers. If you are not aware of this scenario, please read part 1th. Customer data is an important part of this scenario. For this series of scenarios, all customer data will be populated into the database tables at the same time. After this, the stored customer data can be obtained and updated through the ODBC MySQL driver provided by Zend Core. After processing the customer data, the focus shifts to the core banking logic required to provide the bank teller function. We develop a PHP code module that provides core banking logic and uses ODBC for the necessary database access. The main advantage of using Zend Core and PHP to implement banking logic is that built-in MySQL support is available.
After building the database and developing the PHP module, the bank teller is provided with a user interface that performs four core functions. We access the core banking logic encapsulated in the PHP module through a thin client. Specifically, this web-based thin client is generated in an Ajax style: XHTML, cascading style Sheet (CSS), JavaScript, and XMLHttpRequest (XHR). It provides a simple user interface for bank tellers to perform core banking functions. This browser user interface also demonstrates how the browser client logic communicates with the server-side PHP logic for network communication.
By the end of this article, we will build a database, a PHP module that provides core banking logic, and a single page browser user interface, which is part of the banking scene.
MySQL Database
As noted in part 1th, MySQL is an open source database. In our scenario, using the Community server version, this is a compact database server with many useful features. Because the implementation of this banking scenario is based on open source products, MySQL and Zend Core PHP are the right combination. Zend Core itself supports MySQL, as well as a variety of tools that support MySQL management and programming. In our scenario, only MySQL command line clients are used to administer MySQL. We will use the MySQL database for this scenario to establish a bank account database.
Create and populate a bank database
In this scenario, the following account information is stored for the given customer:
Accountholdername
AccountNumber
Checkingbalance
StockName
Stockquantity
StockValue
The account information for a given customer includes the name of the account holder, the account number, the current asset balance, the number of a stock the customer owns, the total number of shares owned, and the current market value of the stock portfolio. The following sections detail how to create a database table, and then populate the table with the account information of some fictitious bank customers. Here we go!