Loading the SQL Anywhere JDBC 3.0 driver

Ensure that the SQL Anywhere JDBC 3.0 driver is in your class file path.

set classpath=install-dir\java\sajdbc.jar;%classpath%

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

DriverManager.registerDriver( (Driver)
    Class.forName(
    "sybase.jdbc.sqlanywhere.IDriver").newInstance()
    );

Using the newInstance method works around issues in some browsers.

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

  • sajdbc.jar must be in your class file path when you run the application.

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