Java JDBC CallableStatement run stored procedure
import java.sql.CallableStatement; import java.sql.Connection; import java.sql.SQLException; import java.sql.Types; public class Main { public static void callableStatementEx(Connection conn){ CallableStatement cs = null; try {// ww w .j a v a2 s . c om cs = conn.prepareCall("{call MY_PROC(?,?)}"); cs.setString(1, "This is a test"); cs.registerOutParameter(2, Types.VARCHAR); cs.executeQuery(); System.out.println(cs.getString(2)); } catch (SQLException ex){ ex.printStackTrace(); } } }