Java Database Connectivity Guide

 

 

 

Defining JDBC Drivers and Data Sources

In the same way a Visual Basic form might use an ODBC database driver to access a database that has been previously set up as an ODBC data source, the Java applet generated from a VB form can use a JDBC driver to access a predefined JDBC data source. JDBC data sources are created using the Database tab in the VB Converter Options dialog, which functions much like the ODBC Administrator dialog in which you define ODBC data sources.


Viewing JDBC Data Sources

When you click the Database tab in the Options dialog, VB Converter displays a list of all the previously defined JDBC data sources. A JDBC data source is a specification that associates a particular database with the specific JDBC driver that is used to access that database. For example, the dmv (ODBC) data source shown below uses the JDBC-ODBC Bridge driver to access the back-end database.

Figure 8: VB Converter Options Dialog - Database Tab

Setting the VB Database API Used.

Select either DAO (Data Access Objects) or ADO (ActiveX Data Objects) depending on which VB database API you are using in your project. If you are uncertain, go to the VB Project menu and select the References menu item. Look at all of the references selected for the one that refers to the database library the project is using. Note: if you are using RDO (Remote Data Objects), your selection here does not matter. RDO is available at the same time as both ADO or DAO since there are not any name clashes.

NOTE: If this does not match what you are using, you will get several errors because VB Converter will not understand how to convert your database access code.


Adding JDBC Drivers to VB Converter

Before you can create a JDBC data source, you must add a JDBC driver to VB Converter. To add a new JDBC driver, click the Drivers... button on the Database tab in the Options dialog. VB Converter opens the Add JDBC Driver dialog.



Adding JDBC Data Sources to VB Converter

After you've added at least one JDBC driver to VB Converter, you can create a JDBC data source. To add a new JDBC data source, click the Add... button on the Database tab in the Options dialog. VB Converter displays the Add Data Source dialog.