Using the driver in an application
To use HCL Informix® JDBC Driver in an application, you must set your CLASSPATH environment variable to point to the driver files. 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 path name of ifxjdbc.jar to CLASSPATH:
setenv CLASSPATH /jdbcdriv/lib/ifxjdbc.jar:$CLASSPATH
To add localized message support, specify ifxlang.jar:setenv CLASSPATH /jdbcdriv/lib/ifxjdbc.jar:/jdbcdriv/lib/ifxlang.jar: $CLASSPATH
- Unpack ifxjdbc.jar and add its directory
to CLASSPATH:
cd /jdbcdriv/lib jar xvf ifxjdbc.jar setenv CLASSPATH /jdbcdriv/lib:$CLASSPATH
To add localized message support, specify ifxlang.jar:cd /jdbcdriv/lib jar xvf ifxjdbc.jar jar xvf ifxlang.jar setenv CLASSPATH /jdbcdriv/lib:$CLASSPATH
Windows
There
are two ways to set your CLASSPATH environment
variable:
- Add the full path name of ifxjdbc.jar to CLASSPATH:
set CLASSPATH=c:\jdbcdriv\lib\ifxjdbc.jar;%CLASSPATH%
To add localized message support, specify ifxlang.jar:set CLASSPATH=c:\jdbcdriv\lib\ifxjdbc.jar;c:\ jdbcdriv\lib\ifxlang.jar;%CLASSPATH%
- Unpack ifxjdbc.jar and add its directory
to CLASSPATH:
cd c:\jdbcdriv\lib jar xvf ifxjdbc.jar set CLASSPATH=c:\jdbcdriv\lib;%CLASSPATH%
To add localized message support, specify ifxlang.jar:cd c:\jdbcdriv\lib jar xvf ifxjdbc.jar jar xvf ifxlang.jar set CLASSPATH=c:\jdbcdriv\lib;%CLASSPATH%
If you are using javax.sql classes (for example, Datasource), specify ifxjdbcx.jar in addition to ifxjdbc.jar.