Configuring the CLASSPATH
The CLASSPATH environment variable is used by the Java Runtime Environment (JRE) or the Java Development Kit (JDK) to locate Java classes and other resource files on your operating system. When you connect to a database through JDBC, this variable must be configured to include the path to the JDBC driver on your operating system, and, in some cases, the path to additional library files specific to the database type you are using.
The following table lists sample file paths that must be typically included in the CLASSPATH variable. Importantly, you may need to adjust this information based on the location of the JDBC driver on your system, the JDBC driver name, as well as the JRE/JDK version present on your operating system. To avoid connectivity problems, check the installation instructions and any pre-installation or post-installation configuration steps applicable to the JDBC driver installed on your operating system.
Database | Sample CLASSPATH entries |
---|---|
Firebird | C:\Program Files\Firebird\Jaybird-2.2.8-JDK_1.8\jaybird-full-2.2.8.jar |
IBM DB2 | C:\Program Files (x86)\IBM\SQLLIB\java\db2jcc.jar;C:\Program Files (x86)\IBM\SQLLIB\java\db2jcc_license_cu.jar; |
IBM DB2 for i | C:\jt400\jt400.jar; |
IBM Informix | C:\Informix_JDBC_Driver\lib\ifxjdbc.jar; |
Microsoft SQL Server | C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc.jar |
MariaDB | <installation directory>\mariadb-java-client-2.2.0.jar |
MySQL | <installation directory>\mysql-connector-java-version-bin.jar; |
Oracle | ORACLE_HOME\jdbc\lib\ojdbc6.jar; |
Oracle (with XML DB) | ORACLE_HOME\jdbc\lib\ojdbc6.jar;ORACLE_HOME\LIB\xmlparserv2.jar;ORACLE_HOME\RDBMS\jlib\xdb.jar; |
PostgreSQL | <installation directory>\postgresql.jar |
Progress OpenEdge | %DLC%\java\openedge.jar;%DLC%\java\pool.jar;
Note: Assuming the Progress OpenEdge SDK is installed on the machine, %DLC% is the directory where OpenEdge is installed. |
Sybase | C:\sybase\jConnect-7_0\classes\jconn4.jar |
Teradata | <installation directory>\tdgssconfig.jar;<installation directory>\terajdbc4.jar |
Note the following points:
•The CLASSPATH setting is available in the Environment Variables setting of your Windows system. Include in the CLASSPATH the path where the JDBC driver is located, separating it from other paths by a semi-colon.
•Changing the CLASSPATH variable may affect the behavior of Java applications on your machine. To understand possible implications before you proceed, refer to the Java documentation.
•Environment variables can be user or system. To change system environment variables, you need administrative rights on the operating system.
•After you change the environment variable, restart any running programs for settings to take effect. Alternatively, log off or restart your operating system.