Introduction to JDBC

JDBC can be used both from client applications and inside the database. Java classes using JDBC provide a more powerful alternative to SQL stored procedures for incorporating programming logic into the database.

JDBC provides a SQL interface for Java applications: if you want to access relational data from Java, you do so using JDBC calls.

The phrase client application applies both to applications running on a user's computer and to logic running on a middle-tier application server.

The examples illustrate the distinctive features of using JDBC in SQL Anywhere. For more information about JDBC programming, see any JDBC programming book.

You can use JDBC with SQL Anywhere in the following ways:

  • JDBC on the client   Java client applications can make JDBC calls to SQL Anywhere. The connection takes place through a JDBC driver.

    SQL Anywhere supports and includes two JDBC drivers: the iAnywhere JDBC driver, which is a Type 2 JDBC driver, and the jConnect driver for pure Java applications, which is a Type 4 JDBC driver.

  • 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.

JDBC resources
  • Example source code   You can find source code for the examples in this chapter in the directory samples-dir\SQLAnywhere\JDBC.

  • JDBC Specification   You can find more on the JDBC Data Access API at [external link] Java SE Technologies - Database.

  • Required software   You need TCP/IP to use the jConnect driver.

    The jConnect driver is available at [external link] jConnect for JDBC.

    For more information about the jConnect driver and its location, see Using the jConnect JDBC driver.


Choosing a JDBC driver
JDBC program structure
Differences between client- and server-side JDBC connections