Installing and setting up
To step through and run many of the database tutorials included in this book, you'll need to install these software components:
Note: All versions of JBuilder provide direct access to SQL data through the JavaSoft JDBC API. Some versions of JBuilder provide additional DataExpress components (on the Data Access tab of the Component Palette) that greatly simplify RAD visual development of database applications, as described in this book. Refer to the JBuilder product page from the Borland Web site at http://www.borland.com for availability of features in each JBuilder version.
The following support topics are also included in this chapter:
Installing JBuilder, JDBC, and the JDBC-ODBC Bridge
When you install JBuilder, select Typical. Or select the Program Files option from the Custom Options Selection. Both options include installation of JBuilder as well as JDBC, the JDBC-ODBC bridge, and JBuilder sample files.
JDBC and the JDBC-ODBC bridge
JBuilder JBCL DataExpress components are implemented using the JavaSoft(tm) database connectivity (JDBC) Application Programmer Interface (API). To create a Java data application, the JavaSoft (tm) JDBC sql package must be accessible before you can start creating your data application. If your connection to your database server is through an ODBC driver, you also need the JavaSoft (tm) JDBC-ODBC bridge software.
The JDBC portion of the setup program installs the classes from the java.sql package in the classes.zip file in the jbuilder\java\lib\ directory.
The JDBC-ODBC bridge portion of the setup program installs the JDBC-ODBC bridge classes in the same classes.zip file. The JdbcOdbc.dll file is installed in the jbuilder\java\bin directory.
For more information about JDBC or the JDBC-ODBC bridge, visit the JDBC(tm) Database Access API Web page at http://splash.javasoft.com/jdbc/.
Installing JBuilder sample files
The JBuilder samples directory contains files necessary for various tutorials and examples presented in this manual. These files are installed by default to the samples\borland\samples\tutorial\dataset directory of your JBuilder installation.
The Typical setup option installs the sample files to your JBuilder directory. Or choose the Custom setup and select the Sample Files option.
Installing Local InterBase Server
After installing JBuilder, run the setup program (Setup.exe) for Local InterBase Server version 4.2 or later, and follow these steps:
- Use the default choices.
Note: The Local InterBase install.txt recommends that you allow InterBase to install into the default directories specified by the setup program.
- Allow the setup program to modify your TCP/IP services file.
- When the ODBC Configuration dialog appears, press Next to add Data Sources.
- On the Data Sources dialog, select "InterBase 4.x Driver by Visigenix" from the list of drivers. Click the Setup button.
Note: If the "InterBase 4.x Driver by Visigenix" is not listed, click the Add button and select this driver to add it to the list. Once it appears in the list, select it and click the Setup button.
- To set up the Data Source Name, from the InterBase ODBC Configuration dialog:
For this option | Make this choice |
|
Data Source Name |
DataSet Tutorial |
Description |
Optional. You can leave this blank |
Network Protocol |
<local> |
Database |
Select the employee database employee.gdb, from your InterBase directory; the default location for this file is
c:\Program Files\Borland\IntrBase\EXAMPLES\employee.gdb |
Username |
SYSDBA |
Password |
masterkey |
|
Click Close to close the DataSources dialog. If you see a message that some files could not be updated because they were in use and will wait for next system reboot, reboot your system. If no message appears, launch the Local InterBase Server in your startup folder.
Tips on using InterBase
- Sample InterBase databases are installed by the setup program. You may wish to make a copy of the employee.gdb sample database so that you can easily restore the file to its original condition after experimenting with database programming.
- These sample databases enforce many constraints on data values, as is normal in a realistic application. The employee table is used extensively in the examples in this manual. Constraints on the employee table include:
- EMP_NO is generated automatically
- FULL_NAME cannot be entered or modified; it is generated from FIRST_NAME and LAST_NAME
- DEPT_NO must be a value that exists in the DEPARTMENT table
These constraints affect all examples where you add, insert, or update data from the employee table and attempt to save the changes back to the server table, for example, the Basic resolving topic.
Select View|Metadata information from the ISQL tool (included with the Local InterBase installation) to explore the constraints on the employee and other tables in the sample InterBase databases.
- One user name and password combination that always works with new InterBase databases is "SYSDBA" (without quotes) as user name and "masterkey" as password. This combination is used in the tutorials in this manual.
Note: InterBase passwords are case-sensitive; the passwords "masterkey" and "MasterKey" are not equivalent. "MasterKey" will not succeed as a default password for the "SYSDBA" user name.
- At any time after the setup program has completed, you can create additional ODBC DataSources by clicking on the ODBC32 icon from the Control Panel.
Connecting to Borland databases
You can connect JBuilder applications to databases created with other Borland applications such as C++ Builder, Delphi, IntraBuilder, Paradox, or Visual dBASE. To do so, look at the underlying database that your application connects to and determine whether the database is a local or remote (SQL) database.
The two options when connecting to local databases such as Paradox or Visual dBASE are:
- Use the JDBC-BDE Bridge in conjunction with Borland Database Engine (BDE)drivers. This allows your JBuilder application to access data stored in any driver format for which there is a BDE driver.
- Use an ODBC driver appropriate for the table type and level you are accessing in conjunction with the JDBC-ODBC bridge software.
To connect to a remote SQL database, you need either of the following:
- An all-Java JDBC driver for your server. Some versions of JBuilder include JDBC drivers. Check the Borland Web page (http://www.borland.com) for availability of JDBC drivers in the JBuilder versions, or contact the technical support department of your server software company for availability of JDBC drivers.
- An ODBC-based driver for your server that you use with the JDBC-ODBC bridge software.
Note: The ODBC driver is a non-portable DLL. This is sufficient for local development, but won't work for Applets or other all-Java solutions.