Java invalid syntax error passing variables to SP
Posted on 2010-08-26
I am receiving a syntax error when trying to pass a variable to a SQL stored procedure.
Here is the java call: (The reason it doesnt look standard is because I'm running in a JSP that has it's own java functions etc).
var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://localhost:1433/DB;instance=MSSQLSERVER','sa','PW');
var result = 0;
var sql = "exec dbo.mirth_test_insert_2('0')"; // this is the line in question
result = dbConn.executeUpdate(sql);
I get the error "Is getting this error in log: Wrapped java.sql.SQLException: Incorrect syntax near '(' " etc.
Thanks in advance