Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere JDBC driver » Connecting from a JDBC client application


Running the connection example

To create and execute the external connection example application
  1. At a command prompt, change to the samples-dir\SQLAnywhere\JDBC directory.

  2. Start a database server with the sample database on your local computer using the following command:

    dbeng11 samples-dir\demo.db
  3. Set the CLASSPATH environment variable.

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

    If you are using the jConnect driver instead, then use the following (where path is your jConnect installation directory):

    set classpath=path\jConnect-6_0\classes\jconn3.jar;%classpath%
  4. Run the following command to compile the example:

  5. Run the following command to run the example:

    java JDBCConnect
  6. Confirm that a list of identification numbers with customer's names appears at the command prompt.

    If the attempt to connect fails, an error message appears instead. Confirm that you have executed all the steps as required. Check that your class path is correct. An incorrect setting may result in a failure to locate a class.