JAVA interacts with database using a common database application programming interface called as JDBC. JDBC allows a developer to write applications that is database independent. So the developer will be interacting with JDBC API rather than getting in to complications of the database.JDBC allows you to write Java code, and leave the platform (database) specific code to the driver. JAVA was designed to be platform independent and JDBC takes java one step ahead making java database code database independent. That means if you use JDBC for connectivity for SQL Server you can run the same code without changing for ORACLE.
Figure: - JDBC as a layer
Different sections in JDBC: -
There are four major components in JDBC. Below is the diagram which shows the four major sections and the way they interact to achieve the final “resultset”.
Figure: - JDBC in detail
Driver manager section creates the connection object. Connection object create the statement object with the required SQL which is then executed against the database. And finally database gives the result back in the resultset.
See the following starter video on Servlet: -
Click to get Java Training
Get more Java training stuffs from author's blog