From the course: Java SE 17 Developer (1Z0-829) Cert Prep

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Making the connection

Making the connection

- Let's look at JDBC URLs, the driver manager and data source. JDBC provides a largely database management system independent framework. Most SQL dialects are broadly similar, but different DBMSs have different communication protocols. A driver provides an interface between Java code and the DBMS implementing the protocol that's actually needed. A URL like thing is used to describe the schema to connect to, and this identifies the DBMS as well as the schema. It can carry properties like username and password and it simplifies making your code DBMS independent. The driver manager class can search through all the registered drivers to identify the right driver for a given URL. Drivers can be registered in several ways. This can be done using the service mechanism and that, although it's a key piece of the platform module system, also exists as a standalone thing prior to Java nine and JPMS's creation. We can list them in a -Djdbc.drivers command line property or you can explicitly load…

Contents