Running the Server-side Connection Example

This section describes how to run the server-side connection example.

  1. If you have not already done so, compile the JDBCExamples.java file. If you are using the JDK, you can do the following in the C:\Documents and Settings\All Users\SybaseIQ\samples\SQLAnywhere\JDBC directory under your Sybase IQ installation directory from a command prompt:
    javac JDBCExamples.java
  2. Start a database server using the demo database. You can start such a server on your local machine using the following command (from the /ASIQ-12_7/java subdirectory):

    On UNIX: start_iq .../iqdemo

    On Windows: start_iq ...\iqdemo

    The TCP/IP network protocol is not necessary in this case, since you are not using jConnect. However, you must have at least 8 Mb of cache available to use Java classes in the database.

  3. Install the class into the demo database. Once connected to the demo database, you can do this from Interactive SQL using the following command:
    INSTALL JAVA NEW 
    FROM FILE 'C:\Documents and Settings\All Users\SybaseIQ\samples\SQLAnywhere\JDBC\JDBCExamples.class'

    where path is the path to your installation directory.

    You can also install the class using Sybase Central. While connected to the demo database, open the Java Objects folder and double-click Add Class. Then follow the instructions in the wizard.

  4. You can now call the InternalConnect method of this class just as you would a stored procedure:
    CALL JDBCExamples>>InternalConnect()

    The first time a Java class is called in a session, the internal Java virtual machine must be loaded. This can take a few seconds.

  5. Confirm that the message Hello World prints on the server screen.