Powered by Blogger.

How many Types of Statements in JDBC ?

>> Thursday, March 31, 2011

In JDBC there are three types of Statements:

1).Statement
2).PreparedStatement
3).CallableStatement
Once a connection is obtained we can interact with the database.These three are Interfaces.By using these three statements we can do the operations on Databases using the methods provided in Interfaces.


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   : Use when you plan to use the SQL statements many times. The PreparedStatement interface accepts input parameters at runtime.

CallableStatement   : Use when you want to access database stored procedures. The CallableStatement interface can also accept runtime input parameters.

Related Posts Plugin for WordPress, Blogger...
© javabynataraj.blogspot.com from 2009 - 2022. All rights reserved.