CallableStatement interface

Can you explain CallableStatement interface in details?

CallableStatement Interface:

It is an interface which is the sub interface of Statement Interface. In this the queries are not written in program like in PreparedStatement interface. In this we use stored procedures for queries. Connection.prepareCall() is used to create new CallableStatement objects which can accept the IN , OUT or INOUT parameters and returns ResultSet.

For example:
import java.sql.*;

class call

{

   public static void main(String args[])

   {

       try

       {

           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

           Connection con = DriverManager.getConnection("jdbc:odbc:students");

           Callable Statement c= con.prepareCall(“{Call insert_data(?,?)});

           //set input parameters

           c.setInt(1,10);

           c.setString(2,”ABC”);

           c.executeUpdate();

           System.out.println(“Record Inserted”);

       }

       catch(SQLException e)

       {

           System.out.println(e);

       }

       catch(ClassNotFoundException e1)

       {

           System.out.println(e1);

       }

   }

}
Batch updates using CallableStatement interface.
Batch updates using CallableStatement interface - Batch update is the ability to add more than one statement at once...
Architecture of a Servet package
Architecture of a Servet package - The javax.servlet package provides interface and classes for writing servlets....
Different Authentication Options available in Servets
Different Authentication Options available in Servets - There are four different options for authentication in servlets...
Post your comment