Loading the iAnywhere JDBC driver

Before you can use the iAnywhere JDBC driver in your application, you must load the appropriate driver. Load the iAnywhere JDBC 3.0 driver with the following statement:

DriverManager.registerDriver( (Driver)
    Class.forName(
    "ianywhere.ml.jdbcodbc.jdbc3.IDriver").newInstance()
    );

Using the newInstance method works around issues in some browsers.

  • As the classes are loaded using Class.forName, the package containing the iAnywhere JDBC driver does not have to be imported using import statements.

  • jodbc.jar must be in your classpath when you run the application.

    set classpath=%classpath%;install-dir\java\jodbc.jar
Required files

The Java component of the iAnywhere JDBC driver is included in the jodbc.jar file installed into the Java subdirectory of your SQL Anywhere installation. For Windows, the native component is dbjodbc11.dll in the bin32 or bin64 subdirectory of your SQL Anywhere installation; for Unix, the native component is libdbjodbc11.so. This component must be in the system path. When deploying applications using this driver, you must also deploy the ODBC driver files.