Running the External Connection Example

This section describes how to run the external connection example

  1. From a system command prompt, change to the Sybase IQ installation directory.
  2. Change to the IQ-15_3/java subdirectory
  3. Ensure that your CLASSPATH environment variable includes the current directory (.) and the imported zip files. For example, from a command prompt (the following should be entered all on one line):
    set classpath=..\java\jdbcdrv.zip;.;..\java\asajdbc.zip;asademo.jar

    The default zip file name for Java is classes.zip. For classes in any file named classes.zip, you only need the directory name in the CLASSPATH variable, not the zip-file name itself. For classes in files with other names, you must supply the zip file name.

    You need the current directory in the CLASSPATH to run the example.

  4. Ensure the database is loaded onto a database server running TCP/IP. You can start such a server on your local machine using the following command (from the IQ-15_3/samples/sqlanywhere subdirectory):

    On UNIX: start_iq .../iqdemo

    On Windows: start_iq ...\iqdemo

  5. Enter the following at the command prompt to run the example:
    java JDBCExamples

    If you wish to try this against a server running on another machine, you must enter the correct name of that machine. The default is localhost, which is an alias for the current machine name.

  6. Confirm that a list of people and products appears at your 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 CLASSPATH is correct. An incorrect CLASSPATH results in a failure to locate a class.

Related concepts
Establish Connection From a Server-side JDBC Class
Connect From a JDBC Client Application Using jConnect
Sybase jConnect JDBC Driver