ASA Programming Guide
JDBC Programming
JDBC provides a SQL interface for Java applications: if you want to access relational data from Java, you do so using JDBC calls.
Rather than a thorough guide to the JDBC database interface, this chapter provides some simple examples to introduce JDBC and illustrates how you can use it on the client and in the database.
The examples illustrate the distinctive features of using JDBC in Adaptive Server Anywhere. For more information about JDBC programming, see any JDBC programming book.
You can use JDBC with Adaptive Server Anywhere in the following ways:
JDBC on the client Java client applications can make JDBC calls to Adaptive Server Anywhere. The connection takes place through a JDBC driver. SQL Anywhere Studio includes two JDBC drivers: the jConnect driver for pure Java applications and the iAnywhere JDBC driver, which is a type 2 JDBC driver.
In this chapter, the phrase client application applies both to applications running on a user's machine and to logic running on a middle-tier application server.
JDBC in the database Java classes installed into a database can make JDBC calls to access and modify data in the database using an internal JDBC driver.
Required software You need TCP/IP to use the Sybase jConnect driver.
The Sybase jConnect driver may already be available, depending on your installation of Adaptive Server Anywhere.
For more information about the jConnect driver and its location, see The jConnect driver files.
Example source code You can find source code for the examples in this chapter in the file Samples\ASA\Java\JDBCExamples.java in your SQL Anywhere directory.
For more information about how to set up the Java examples, including the JDBCExamples class, see Setting up the Java sample.
Choosing a JDBC driver
JDBC program structure
JDBC in the database features
Differences between client- and server-side JDBC connections