Java JDBC is a java API to connect and perform question with the database. JDBC API uses jdbc motorists to talk with the database.
What is JDBC?
JDBC appears for Java Database Connection, which is a standard Java API for database-independent connection between the Java development language and a variety of databases.
The JDBC collection includes APIs for the duties mentioned below that are affliated with details resource utilization.
1. Making an organization to a details resource.
2. Creating SQL or MySQL claims.
3. Performing SQL or MySQL concerns in the database.
4. Watching & Changing the causing records.
Fundamentally, JDBC is a requirements that provides a complete set of connections that allows for convenient option a details resource. Java can be used to write various types of executables, such as
Java ServerPages (JSPs)
Business JavaBeans (EJBs).
All of these different executables are able to use a JDBC motorists to accessibility a databases, and take advantage of the saved details.
JDBC gives the same capabilities as ODBC, enabling Java programs to contain database-independent code.
Before going further, you need to have a good knowledge of the following two topics −
Primary JAVA Programming
SQL or MySQL Database
The JDBC API allows both two-tier and three-tier managing models for details resource accessibility but in general, JDBC Framework comprises of two levels −
JDBC API: This provides the application-to-JDBC Administrator connection.
JDBC Car owner API: This allows the JDBC Manager-to-Driver Connection.
The JDBC API uses a person manager and database-specific motorists to provide clear connection to heterogeneous details resource.
The JDBC motorists manager guarantees that the correct motorists is used to accessibility each details resource. The motorists manager is able to support several concurrent motorists connected to several heterogeneous details resource.
Common JDBC Components
The JDBC API provides the following connections and sessions −
DriverManager: These class controls a list of database motorists. Suits connection demands from the java program with the proper details resource motorists using connections sub method. The first motorists that recognizes a certain subprotocol under JDBC will be used to create a details resource Connection.
Driver: This interface controls the emails with the database server. You will connect straight with Car owner aspects hardly ever. Instead, you use DriverManager aspects, which controls aspects of this type. It also abstracts the information associated with working with Car owner aspects.
Connection: This interface with all methods for calling a database. The text item symbolizes connections perspective, i.e., all connections with database is through connection item only.
Statement: You use aspects created from this interface to publish the SQL states to the database. Some produced connections agree to aspects in addition to performing saved techniques.
ResultSet: These things hold details retrieved from a data base after you perform SQL question using Declaration aspects. It functions as an iterator to allow you to move through its details.
SQLException: These types control any mistakes that occur in a details resource program.
The JDBC 4.0 Packages
The Java.sql and javax.sql are the main provides for JDBC 4.0. This is the latest JDBC version at the time of writing this guide. It provides the main programs of training for getting your web resources.
The new features in these provides include of changes in the following areas −
Automatic details resource car owner running.
Exception managing developments.
Enhanced BLOB/CLOB performance.
Connection and announcement interface developments.
National character set support.
SQL ROWID access.
SQL 2003 XML details type support.
You can Learn JDBC and know more about Java Database by going through our Java Database tutorial.