Click here to Skip to main content
14,734,056 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a java code,in which i want to call a stored procedure(sql server2012).I don't know how to pass the parameter to that stored procedure because the java code accepts command line arguments.So please suggest me how to pass the input through command line arguments
Posted

1 solution

Here is an example: JDBC CallableStatement – Stored Procedure IN parameter example[^]
Example:
//insertDBUSER is stored procedure
String insertStoreProc = "{call insertDBUSER(?,?,?,?)}";
callableStatement = dbConnection.prepareCall(insertStoreProc);
callableStatement.setInt(1, 1000);
callableStatement.setString(2, "mkyong");
callableStatement.setString(3, "system");
callableStatement.setDate(4, getCurrentDate());
callableStatement.executeUpdate();
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900