Java JDBC CallableStatement create
import java.sql.CallableStatement; import java.sql.Connection; import java.sql.Date; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Types; public class Main { public static void main(String[] args) { try {//from w ww . jav a 2 s . c o m Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/contact", "username", "password"); String query = "{CALL GETDATE(?,?)}"; CallableStatement callableStatement = (CallableStatement) conn.prepareCall(query); callableStatement.setInt(1, 123); callableStatement.registerOutParameter(1, Types.DATE); callableStatement.executeQuery(); Date date = callableStatement.getObject(2, Date.class); } catch (SQLException ex) { ex.printStackTrace(); } } }