Getting an output parameter from a stored procedure
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
public class CheckPassword {
public static void main(String args[]) throws Exception {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:Customers", "user", "pwd");
CallableStatement cs = con.prepareCall("{call CHECK_USER_NAME(?,?,?)}");
cs.setString(1, "C");
cs.setString(2, "V");
cs.registerOutParameter(3, java.sql.Types.VARCHAR);
cs.executeUpdate();
System.out.println(cs.getString(3));
con.close();
}
}
Related examples in the same category