From Twitter

JDBC API

Now, we will learn about the JDBC API. The JDBC API is implemented through the
JDBC driver. The JDBC Driver is a set of classes that implement the JDBC interfaces
to process JDBC calls and return result sets to a Java application. The database (or
data store) stores the data retrieved by the application using the JDBC Driver.
The API interface is made up of 4 main interfaces:

• java.sql DriverManager
• java. sql .Connection
• java. sql. Statement
• java.sql.Resultset
 
In addition to these, the following support interfaces are also available to the
developer:
 
• java.sql.Callablestatement
• java. sql. DatabaseMetaData
• java.sql.Driver
• java. sql. PreparedStatement
• java. sql .ResultSetMetaData
• java. sql. DriverPropertymfo
• java.sql.Date
• java.sql.Time
• java. sql. Timestamp
• java.sql.Types
• java. sql. Numeric
 
The main objects of the JDBC API include:

 • A DataSource object is used to establish connections. Although the Driver
Manager can also be used to establish a connection, connecting through a
DataSource object is the preferred method.
 
• A Connection object controls the connection to the database. An application
can alter the behavior of a connection by invoking the methods associated with
this object. An application uses the connection object to create statements.
 
• Statement object are used for executing SQL queries.
 

Different types of JDBC SQL Statements
 

a) java.sql.Statement : Top most interface which provides basic methods useful for
executing SELECT, INSERT, UPDATE and DELETE SQL statements.
b) java.sql.PreparedStatement : An enhanced verion of java.sql.Statement which
allows precompiled queries with parameters. A PreparedStatement object is used
when an application plans to specify parameters to your SQL queries. The
statement can be executed multiple times with different parameter values
specified for each execution



c) java.sql.CallableStatement : It allows you to execute stored procedures within a
RDBMS which supports stored procedures. The Callable Statement has methods
for retrieving the return values of the stored procedure.
A ResultSet Object act like a workspace to store the results of query. A ResultSet is
returned to an application when a SQL query is executed by a statement object. The
ResultSet object provides several methods for iterating through the results of the
query.


No comments:

Post a Comment

Labels

(MCS-031 (6) 2011 (5) 4nf (1) 5nf (1) ACCESS CONTROL In Relational Database (1) ALGORITHMICS (5) assignment 2014 2015 (1) AVAILABLE TOOLS & ALGORITHMS (5) BCA (1) BINARY SEARCH (1) Block Nested Loop Join (1) Build and Fix Model (1) BUILDING BLOCKS OF ALGORITHMS (1) CHARACTERISTICS OF AN ALGORITHM (2) Core Java (1) Data Communication Network Security (1) DATABASE SECURITY (1) EER tool (1) ELEMEMTARY ALGORITHMICS (2) ENHANCED ER TOOLS (1) EVOLUTION (1) EXAMPLE OF AN ALGORITHM (2) Indexed Nested-Loop Join (1) install servelet engine (1) INTRODUCTION (1) Iterative Enhancement Model (1) Java Server Pages (1) JDBC (1) JSP (2) LEVELS OF DATABASE SECURITY (1) MCA (9) MCA 051 (1) MCA 3rd Semester (8) MCA 4th Semester (1) MCA 5 sem (1) MCS-031 (7) MCS-031 : DESIGN AND ANALYSIS OF ALGORITHM (14) MCS-032 (1) MCS-033 (1) MCS-034 (2) MCS-035 (1) mcs-041 (2) MCS-042 (1) mcs-043 (2) mcs-052 solved assignment (1) MCSL-036 (2) Nested loop join (1) OBJECTIVES (1) Operating System (2) OUTLINE OF ALGORITHMICS (1) Principles of Management and Information Systems (1) PROBLEMS (1) QUERY PROCESSING AND EVALUATION (1) Query processing Optimisation (1) Question Papers (8) Related Topic (9) relational Database (1) SELECT OPERATION Query Processing (1) Servlet (1) Servlet Programme (1) Servlet Programming (1) SOFTWARE DEVELOPMENT MODELS (4) SOFTWARE ENGINEERING (4) Solution (7) Solved Assignment 2013 2014 (6) SOME PRE-REQUISITES AND Asymptotic Bounds ASYMPTOTIC BOUNDS INTRODUCTION (1) STATISTICAL DATABASE SECURITY (1) structure (1) SUMMARY (1) Waterfall Model (1) Write a C program to print the following triangle (1)