JDBC Statement vs PreparedStatement vs CallableStatement

JDBC Statement, PreparedStatement and CallableStatement are interfaces which provide ways to interact with Databases(Oracle / MySQL / PostGre…etc) with the help of methods in it. But these statements have some difference in terms of features they provide.

JDBC Statement

Used for firing static queries(e.g. select * from table). JDBC Statements can not accept parameters.

Syntax of Statement

		Statement statement = null;
		Connection connection = null;
		try {


		} catch (ClassNotFoundException e) {

		try {

			connection = DriverManager.getConnection(
					"jdbc:oracle:thin:@localhost:1521:" + dbName, userName,

		} catch (SQLException e) {


				statement = connection.createStatement();

				statement.execute(<Static Query>);


Prepared Statement

PreparedStatement extends Statement Interface to provide extra feature. It(PreparedStatement) is useful when firing the same SQL statement is required. PreparedStatement Interface accepts input parameter at runtime. PreparedStatement Objects are percompiled hence there execution is faster.

Syntax of PreparedStatement


		String inserRecordQuery= "insert into JBT values('beginne','Hibernate')";
		PreparedStatement  preparedStatement = null;
		Connection connection = null;


				preparedStatement = connection.prepareStatement(inserRecordQuery);




CallableStatement extends PreparedStatement Interface to provide more feature then PreparedStatement. It is used when database Stored Procedure needs to be invoked.

By | 2017-11-18T08:39:04+00:00 October 28th, 2012|Oracle|5 Comments

About the Author:


  1. kaustubh April 10, 2014 at 9:37 am - Reply

    Great Tutorial,man !!

  2. Kaustubh Baraskar-NSE April 10, 2014 at 9:38 am - Reply

    Expecting more such exciting tutorials!

  3. Manish joshi August 31, 2015 at 5:00 am - Reply

    not that much great but good content
    but it should be specify with some diagram and internal things then it will more helpfulL for beginner

  4. Rapolu January 21, 2016 at 10:00 am - Reply

    good useful info… add some more content

  5. akash patel March 15, 2016 at 5:28 pm - Reply

    add a lot of contain …incomplete

Leave A Comment