Skip to main content

Quick-and-dirty Java programming: Setting up a data source for JDBC

Return to article.

The sample programs in this article are set up so you can use them with the widely available mySQL OpenSource RDBMS server. By simply changing the driver and connection URL, you can get the sample to work with your own RDBMS. I have provided an MS Access-compatible MDB file for those who would like to use the JDBC-ODBC bridge provided as part of the Win32 distribution of the JDK. You will find the database file in the source distribution as fesitest.mdb. To modify the samples for using with this database, follow these steps:

  1. Using the ODBC-32 applet in the Control Panel, set up a system data source named devworks to point to the fesitest.mdb file

  2. Change the JDBC driver in the sample program to use sun.jdbc.odbc.JdbcOdbcDriver

  3. Change the Connection URL in the sample program to use jdbc:odbc:devworks

When you run the DBScriptFlex.es example, be sure to modify the SQLcmds dbinit.ini entry to msDBPop.sql. This is necessary because the DDL varies between mySQL and MS Access. If you want to run DBScript.es under MS Access, you must modify the Create Table statement according to the content of msDBPop.sql. GUIViewer.es should work fine with MS Access once you have changed the JDBC driver and URL.

Return to article.