package org.best.example;
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);
} }
}
}
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);
} }
}
}
No comments:
Post a Comment