Link to home
Start Free TrialLog in
Avatar of robthomas09
robthomas09

asked on

Java invalid syntax error passing variables to SP

Hello experts,

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);

globalMap.put('PER_NBR', result)
dbConn.close();
return message;

I get the error "Is getting this error in log: Wrapped java.sql.SQLException: Incorrect syntax near '(' " etc.

Thoughts?

Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of ram_0218
ram_0218
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robthomas09
robthomas09

ASKER

Thanks for the reply ram - we did give that a try and apparently our environment doesnt support that callableStatement object.