Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java invalid syntax error passing variables to SP

Posted on 2010-08-26
2
Medium Priority
?
518 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
ram_0218 earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

618 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