Posts

Showing posts with the label JDBC Statements

JDBC Statements

There are three main types of Statement objects: the base class Statement , the PreparedStatement , and the CallableStatement . These objects are instantiated from your JDBC Connection object. Following table provides a summary of each interface's purpose to understand how do you decide which interface to use: Interfaces Recommended Use Statement Use for general-purpose access to your database. Useful when you are using static SQL statements at runtime. The Statement interface cannot accept parameters. PreparedStatement  used to run Pre compiled sql.   Use when you plan to use the SQL statements many times. The PreparedStatement interface accepts input parameters at runtime. CallableStatement used to execute the stored procedures. The CallableStatement interface can also accept runtime input parameters. Note:For simplicity, in the following examples we will use the Locations table in hr schema that we used...

JDBC TUTORIAL

Image
What is JDBC? A JDBC driver is a software component enabling a Java application to interact with a database.It is a specification that tells vendor how to write a driver program to interface java program with their database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database. JDBC helps you to write Java applications that manage these three programming activities: 1.      Connect to a data source, like a database 2.      Send queries and update statements to the database 3.      Retrieve and process the results received from the database in answer to your query What are we going to cover in this tutorial?? * JDBC Architecture                                               * Types Of JDBC Drivers * Ste...