JDBC in Java: 5 facts to know before you begin

Are you a Java novice? Specifically, are you in the early stages of your Java Database Connectivity relationship? Here are five interesting facts about JDBC in Java that you should know.

JDBC doesn't stand for Java Database Connectivity

Sun Microsystems trademarked the term JDBC, and nowhere in said trademark does it denote that JDBC stands for Java Database Connectivity. The term JDBC obviously refers to the set of APIs packaged in the JDK that facilitate interactions with a relational database, but, legally speaking, JDBC is a term unto itself.

JDBC is for relational databases only

For organizations that want massive scalability, NoSQL databases such as MongoDB and Cassandra are all the rage. But don't try to connect to them with JDBC in Java. It is only for relational databases, so stick with the Apache Derby and MySQL instances.

JDBC connections are expensive

When you learn how to program against a database with JDBC in Java, most tutorials will tell you to create a database connection every time you perform a database interaction. Doing that is very expensive.

But, how do you avoid the performance impact of a stand up/tear down of a JDBC connection? A JDBC connection pool is the answer. A connection pool will create a collection of JDBC connections, and dole those connections out to your program any time there's a need to interact with the database. When your program is done with a given connection, the connection gets returned to the pool for another part of the application to use. This allows for many database interactions to happen with the creation of only a few JDBC connection objects.

The JDBC and ODBC bridge

ODBC is a Microsoft-based specification used by databases such as Access and SQLServer. You can consider ODBC a competitor to JDBC, but that doesn't mean you can't connect to ODBC-compliant databases with the JDBC API. A JDBC-ODBC driver allows you to easily connect your Java programs to ODBC-compliant databases.

JDBC hasn't changed much

With every new release of the JDK, new features and enhancements are added to the JDBC API. But despite the ongoing, incremental changes, the JDBC API has changed very little since the first Java release. Any code that was written 20 years ago for Java 1.1 would still compile and run today on the Java 12 release. Even though the Java API continues to evolve, the Java language architects have always made backwards compatibility a priority, and the JDBC APIs are no exception.

View All Videos
App Architecture
Software Quality
Cloud Computing
Security
SearchAWS
Close