ASA Programming Guide
JDBC Programming
Establishing JDBC connections
Establishing a connection from a server-side JDBC class
This section describes how to run the server-side connection example.
To create and execute the internal connection example application
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 Samples\ASA\Java directory from a command prompt:
javac JDBCExamples.java
Start a database server using the sample database. You can start such a server on your local machine using the following command (from the Samples\ASA\Java subdirectory):
start dbeng9 ..\..\..\asademo
The TCP/IP network protocol is not necessary in this case since you are not using jConnect.
Install the class into the sample database. Once connected to the sample database, you can do this from Interactive SQL using the following command:
INSTALL JAVA NEW FROM FILE 'path\Samples\ASA\Java\JDBCExamples.class'
where path is the path to your installation directory.
You can also install the class using Sybase Central. While connected to the sample database, open the Java Objects folder and choose File
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.
Confirm that the message Hello World prints on the server screen.