Using the Connection Class

Before we can do anything significant with JDBC, we must get connected to the database. As we will find in this chapter, we will not connect directly to the database; we will connect with one or more layers of software, which will control our connection to the database.

As mentioned earlier, there are two distinct approaches for connecting to a database using JDBC: using a DriverManager directly or using a DataSource connection. This chapter presents both approaches.

Loading the Database Driver

There is unfortunately no standard protocol for direct communication with relational databases. Each relational database vendor has created a proprietary low-level protocol for communicating with its database engine.

In the intensely ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.