Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
At a command prompt, change to the samples-dir\SQLAnywhere\JDBC directory.
Start a database server with the sample database on your local computer using the following command:
For server-side JDBC, it is not necessary to set the CLASSPATH environment variable.
Enter the following command to compile the example:
Install the class into the sample database using Interactive SQL. Run the following statement:
INSTALL JAVA NEW FROM FILE 'samples-dir\SQLAnywhere\JDBC\JDBCConnect2.class'
You can also install the class using Sybase Central. While connected to the sample database, open the Java Objects folder and choose File > New > Java Class. Then follow the instructions in the wizard.
Define a stored procedure named JDBCConnect that acts as a wrapper for the JDBCConnect2.main method in the class:
CREATE PROCEDURE JDBCConnect() EXTERNAL NAME 'JDBCConnect2.main([Ljava/lang/String;)V' LANGUAGE JAVA;
Call the JDBCConnect2.main method as follows:
The first time a Java class is called in a session, the Java VM must be loaded. This might take a few seconds.
Confirm that a list of identification numbers with customers' names appears in the Server Messages window.
If the attempt to connect fails, an error message appears instead. Confirm that you have executed all the steps as required.