My procedure iscreate procedure deftest2@in1 int =5,@in2 int =4as insert into dummydata values(@in1,@in2,20);
My java code to execute this proc isString sCallQuery = "{ call deftest2 (,?)}";CallableStatement cstmt= con.prepareCall(sCallQuery); cstmt.setInt(1,100); cstmt.execute();I get following errorjava.sql.SQLException: Incorrect syntax near ','. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487) at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:478) at ProcTest.main(ProcTest.java:152)
I am trying this on MS SQL with JTDS driver.Here I was expecting it to consider value 100 for in2 and consider default 5 for in1.Please let me know where I am going wrong.Is there any document or tutorial which explains about use of default values through java ?Similar thread in another forum is http://www.daniweb.com/forums/post768508.html#post768508