Solved

Java invalid syntax error passing variables to SP

Posted on 2010-08-26
2
505 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:robthomas09
2 Comments
 
LVL 17

Accepted Solution

by:
ram_0218 earned 500 total points
ID: 33534091
need to use callablestatement?
0
 

Author Comment

by:robthomas09
ID: 33534411
Thanks for the reply ram - we did give that a try and apparently our environment doesnt support that callableStatement object.  
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now