Table of Contents
This chapter provides information on connecting DODS applications to specific database types. In general, you need to add the database configuration information to the application configuration file (e.g., simpleApp.conf). Configurable items in the code snippets that you need to specify, such as path names or database identifier, are enclosed in brackets and italicized (for example, <path_name> or <database_id>).
Important DODS connects to databases using a JDBC driver. DODS has its own class loader, but the JDBC driver must be loaded by the system class loader. Therefore, it is important to specify the path to the JDBC driver in your system CLASSPATH and not in the DODS application’s CLASSPATH.
A common way to specify the path to the JDBC driver is to save the driver in a lib directory in the project and define the CLASSPATH in the run script. To do this, follow these steps:
1 Create a lib directory in the top level of your project and copy your JDBC driver to this directory.
2 Edit your application’s run file template, start.in, (in the <appName>/input directory) to place the driver in your CLASSPATH. For example:
... # # Build up classpath. # CLASSPATH="../lib/idb.jar/;../lib/jta-spec1_0_1.jar" APPCP="${DODS_LIB}${PS}../classes" ...
3 Build the project with ant, which will copy the run script to the directory <appName>/output. Use this script to start your application.
Be careful to keep the right driver with your application. For example, there are multiple versions of the Oracle JDBC driver, classes111.zip. When your application goes into production, make sure that the project administrator knows to reference the correct driver when the database is upgraded in the future.