Advertisement

Udemy WW Udemy WW

Thursday 1 December 2011

Calling Procedure through Java Program

//calling Procedure
import java.sql.*;
class MyProcedure
{
public static void main(String arg[])
{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection c=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","student","student");
CallableStatement cs=c.prepareCall("{call updaterec(?,?,?)}");
cs.setInt(1,420);
cs.setString(2,arg[0]);
cs.setInt(3,2055);
int a=cs.executeUpdate();
System.out.println("value="+a);
}
catch(Exception e)
{
System.out.println(e);
}
}
}

No comments:

Post a Comment

Advertisement

Udemy WW