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

SQL Anywhere 10.0.1 » SQL Anywhere Server - Programming » SQL Anywhere JDBC API » Connecting from a JDBC client application

How the connection example works Next Page

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:

    dbeng10 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=%classpath%;path\jconnect-6_0\classes\jconn3.jar;
  4. Enter the following to compile the example:

    javac JDBCConnect.java
  5. Enter the following 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.