Solved

Java invalid syntax error passing variables to SP

Posted on 2010-08-26
2
510 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 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 video teaches viewers about errors in exception handling.

762 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