Sample database application
This chapter describes a sample database application developed using DataExpress components and the JBuilder design tools. Where necessary, the code generated by the design tools was modified to provide custom behavior. There are no tutorial steps on this application as it is intended to consolidate the individual "how to" topics discussed elsewhere in this book.
The completed files for this sample application are included in the jbuilder/samples/DataExpress/BasicApp subdirectory of your JBuilder installation under the project name BasicApp.jpr.
This application demonstrates the following functionality:
- Connects to the JDataStore sample database, employee.jds, using the Database and QueryDataSet components. (See "Connecting to a database" and "Querying a database".)
- Contains a JdbTable which displays the data while also demonstrating the following features:
- Persistent columns, which are columns where structure information typically obtained from the server is specified as a column property instead. This offers performance benefits as well as persistence of column-level properties. (See "Persistent columns" for more information on this feature.) In the designer, double-click the data set to open the Column designer to view more information on each column.
- Formatting of the data displayed in the JdbTable using display masks (the HIRE_DATE column). (See "Adding an edit or display pattern for data formatting".)
- Data editing that is controlled using edit masks (the HIRE_DATE column). (See
"Adding an Edit or Display Pattern for data formatting".)
- Calculated and aggregated fields which get their values as a result of an expression evaluation (the NEW_SALARY, ORG_TOTAL, NEW_TOTAL, DIFF_SALARY, AND DIFF_TOTAL columns). (See "Using calculated columns".)
- Includes a JdbStatusLabel control that displays navigation information, data validation messages, and so on.
Messages are written to the JdbStatusLabel control when appropriate, or when instructed programmatically. (See "Displaying status information".)
- Provides a JdbNavToolBar for easy navigation through the data displayed in the table.
- Lets you locate data interactively using a JdbNavField which is embedded in the JdbNavToolBar. For more information on locating data, see "Locating data".
- Uses a DBDisposeMonitor to automatically close the database connection when the frame is closed.
- Resolves changes made to the data in the QueryDataSet by using default resolver behavior. (See "Basic resolving".) The Save button of the JdbNavToolBar performs the save. Messages regarding the resolve process are displayed in the JdbStatusLabel control.
Sample international database application
Writing an international application involves additional complexities which impact application development, for example, using locales other than en_US (American English).
For an example of an international database application that includes many common features of a database application in addition to support for multiple languages and locales, see the IntlDemo.jpr file in the jbuilder/samples/MultiLingual subdirectory of your
JBuilder installation.