O'Reilly logo

PURE Java™ 2 by Kenneth Litwak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Database Connection

You need a database connection to talk to a database system. There are two key elements in a database connection:

  • java.sql.DriverManager

  • A JDBC Driver

It is the responsibility of the DriverManager class to maintain a list of instances of JDBC drivers available to a given JVM at runtime. Essentially, this list provides information about the object reference of a driver and the subprotocol, or database type, that it supports. When a program requests a database connection, the DriverManager goes through the list, asking each driver if it can process the getConnection() request. The search is based on the database URL supplied in the getConnection() call, which is discussed later in this chapter. The DriverManager tells ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required