O'Reilly logo

Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams by Jamie Jaworski

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

Connecting to a Database

NOTE

After you learn how to connect to your database, the type of server that you are using will not matter—JDBC provides a server-independent approach to database access. That's one of JDBC's major benefits!

Database drivers enable communication between your code and the database server. The hsql database comes with several database drivers that are packaged in the hsqldb.jar file. You will use a Type 4 driver to communicate between your code and the hsql database server. The first thing that you will need to do is load the driver. You can do this by using the forName() method of the java.lang.Class class:

Class.forName("org.hsqldb.jdbcDriver");

org.hsqldb.jdbcDriver is the JDBC driver that is provided in the hsqldb.jar ...

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