Viewers: in countries Watching now:
Whether you're building a web- or desktop-based application with Java SE or Java EE, many Java applications need to integrate data from a relational database. This course describes how to read and manage data from relational databases such as MySQL and SQL Server using the Java Database Connectivity (JDBC) API.
Author David Gassner explains how to choose a JDBC driver and connect to one or more databases. He also provides detailed instructions on reading, selecting, and updating data; calling stored procedures; managing data via JavaBean classes or with prepared statements; and working with metadata.
In this video series, I describe how to integrate applications built with the Java programming language with relational databases using JDBC, and I'm going to start by describing the nature and history of JDBC and how it fits into the larger Java World. JDBC is an API, a set of interfaces and classes that let you easily connect to relational databases, such as Oracle, SQL Server, MySQL, and many others. It was originally known as Java Database Connectivity, but more recently it's been known by simply the acronym JDBC.
JDBC was introduced into the Java programming language very early. It was included in JDK1.1 in 1997, and has been a part of all releases of Java Standard Edition ever since. The history of JDBC is a history of added features and improved performance. The original release in 1997 included the main classes and interfaces that you'll find yourself using all the time, including the Connection interface which lets you make your initial connection to a database, the Statement which encapsulate SQL code, and ResultSet which returns data from the server.
Later versions of JDBC improved the features of the API, including the ability to update your data without SQL, improved performance, pooled connections, scrolling, and more data types. More recent releases have included more data types, the ability to work with stored procedures, and the ability to get metadata, or lists of tables and column information, from your database. In the most recent versions of Java, JDBC 4.0 was released with Java 6, and it included the ability to load drivers automatically.
I'll describe the benefit of this feature in an early video of this series. And in the most recent version of JDBC, JDBC 4.1 which is included in Java 7, there are features that let you reduce the amount of code it takes to work with your databases. So who uses JDBC? It's most commonly used in web-based applications that are hosted in JEE or Java Enterprise Edition servers. These include J Boss, Tomcat, WebSphere, and others. Developers also commonly use JDBC when they're working on desktop applications or applets that are working either with local databases stored on the client computer or with remote databases accessed over the Internet.
Less common uses include JDBC in Android applications. Android has its own API for working with local databases, specifically SQLite, and so developers typically don't use JDBC there. And when you're working with larger databases making calls from Android applications, it's more common to make calls to those databases through web services hosted by middleware servers. But if you're a Java programmer, it is important to understand what JDBC is and how it works, because even if you're working through Android or through web services, someone somewhere is probably using JDBC somewhere in your calling chain, and it's useful to know how it works.
There are other ways of getting to databases without doing direct JDBC programming. There are higher-level abstractions that are delivered as part of the large application frameworks. For example, the Spring application framework includes something called JDBC Template. It simplifies the amount of code you have to write, but in the background it's using JDBC to talk to the database. There's a similar but perhaps less popular templating library called RIFE, which does basically the same thing. And then there are data mapping APIs, the most popular is Hibernate.
Hibernate is something called an object-relational mapping API. It represents your database structure with Java classes and objects. In the background it's still using JDBC to communicate with the database, but it simplifies the amount of code you have to write in your own application. And there are other mapping libraries, such as iBATIS from Apache, and the Java Persistence API or JPA, which is actually a part of the Java EE platform. Again, regardless of whether you use JDBC directly, or you use one of these higher-level application frameworks or data mapping APIs in the background, JDBC is at work.
So by working through this video series, you'll be able to gain a greater understanding of how the Java programming language connects to databases and what are some of the pitfalls and benefits of using JDBC.
There are currently no FAQs about Java Database Integration with JDBC.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.