Using the driver in an application

To use HCL OneDB™ JDBC Driver in an application, you must set the Java™ virtual machine (JVM) CLASSPATH to point to the driver libraries. The CLASSPATH environment variable tells the Java virtual machine (JVM) and other applications where to find the Java class libraries used in a Java program.

UNIX™

There are two ways to set your CLASSPATH environment variable:
  • Add the full or relative path name of onedb-jdbc-complete.jar to CLASSPATH:
    export CLASSPATH=/path/to/onedb-jdbc-complete.jar:$CLASSPATH
  • Specify the path to the driver in the java or javac -cp command line option CLASSPATH:
    java -cp /path/to/onedb-jdbc-complete.jar ...

Windows™

There are two ways to set your CLASSPATH environment variable:
  • Add the full path name of onedb-jdbc-complete.jar to CLASSPATH:
    set CLASSPATH=c:\path\to\onedb-jdbc-complete.jar;%CLASSPATH%
  • Specify the path to the driver in the java or javac -cp command line option CLASSPATH:
    java -cp /path/to/onedb-jdbc-complete.jar ...