Stored,Procedure,Calling,in,java

Ron 10/24/2016 0

Stored Procedure Calling in java

Java
 import java.sql.*;
    class ProcedureCalling {
         public static void main(String args[]){
             try{
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
             Connection con=DriverManager.getConnection("jdbc:odbc:test1","sa","password");
             String sql= "{ call procname(?) }"; // procname is name of procedure
             cst=con.prepareCall(sql);
             int i=1;
             cst.registerOutParameter(1,Types.NUMERIC,0);
             cst.setInt(1,i);
             cst.executeUpdate();
             i=cst.getInt(1);
         }catch(Exception proc)
             { System.out.println("error ine executed query is :"   proc);
     } }
}
}
 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments