Wednesday, June 4, 2008

How to Call a Stored procedure usig JDBC Connection

After having the connection Object you can call any Stored Procedure using following Code.
Here spGetEventClient is the Stored procedure accepts one Argument.
try {
conn = dataSource.getConnection();
CallableStatement cs1 = conn.prepareCall("{call spGetEventClient(?)}");
cs1.setInt(1,13264);
ResultSet rs1 = cs1.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

No comments: