- Details
- Written by Nam Ha Minh
- Last Updated on 25 October 2024   |   Print Email
This page is designed for those who are new to database programming with Java and want to have a comprehensive, well-curated list of tutorials to follow a long. Beginners will find this page a great learning resource to get started with JDBC, intermediate programmers will find it's great to refresh their knowledge, and experienced ones will find it's a helpful reference for their daily programming tasks.You know, JDBC is an application programming interface (API) that enables Java applications working with relational databases in a standard way. JDBC acts as an abstraction layer between Java application and the database, allowing programmers to write Java code once and run that code on different databases without modifying the code - only JDBC driver needs to be changed.The JDBC API is part of
Java SE so you don't have to import any external libraries to use. Just import interfaces and classes from the two packages
java.sql and
javax.sql. The latest version is JDBC 4.3 which is included in Java SE 9 or newer.
1. Prerequisites for JDBC Programming:
These are two must-have JDBC references: you can find in the first one the official links and Maven dependency to get JDBC drivers for popular database systems, and the second reference helps you understand the JDBC URL syntax for different databases.
2. Fundamental JDBC Tutorials:
The following tutorials are fundamentals to learn JDBC. You will get started by creating new connection to a database server, then learn how to execute different types of queries (CRUD - Create, Retrieve, Update and Delete). The tutorial about JDBC transaction is a little more advanced, and the last one explains how to execute database stored procedures within Java applications.
3. Making Connection to a specific database:
You can find in the following articles the proven code examples about creating connection to various database systems: MySQL, Oracle, Microsoft SQL Server, PostgreSQL, SQLite, Microsoft Access, MongoDB and H2.
4. Apache Derby (JavaDB) Tutorials:
Apache Derby is a lightweight, portable database engine written in Java so it's a perfect choice for embedding small relational databases in Java applications. The following tutorials help you write code to use Apache Derby in different modes: embedded and client-server.
5. Advanced JDBC Tutorials:
You can find in the following articles the helpful code examples about advanced database operations such as reading database meta data, using scrollable and updatable result sets, using cached rowset, inserting binary (byte arrays) data into database. And the last tutorial about JDBC batch update will help you optimize your application in terms of updating a large amount of data to the database.
6. Miscellaneous JDBC Tutorials:
Sometimes you need to get the names of all database schemas, or get the ID value of the recently-inserted record - these examples will help:
7. Other Tutorials that are based on JDBC:
Integrating JDBC with other technologies is necessary to develop completely functional database-driven applications. Practice the following tutorials to learn using JDBC in Java web applicatitions with Servlet, Spring framework and Spring Boot.
8. JDBC Tutorial Videos:
Like to learn following videos? Check this playlist on YouTube:
Java Database Programming with JDBC JDBC References:
About the Author:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on
Facebook and watch
his Java videos on YouTube.