File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Error executing sql statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error executing sql statement" Watch "Error executing sql statement" New topic
Author

Error executing sql statement

gunjaan titiyaa
Greenhorn

Joined: May 18, 2009
Posts: 3
Hi,
I switched my jdbc driver from type 2 to type 4, right now i m using microsoft sql server jdbc driver of type 4. so as i generate any report in my application it throws error like: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : DataSummaryReport_2

I am using stored procedure to retrieve data like: exec wdcGetDataSummaryData $P{SerialNumberStr},$P{Date}

I have migrated from jdk1.4 to 1.6.

can you please help me to solve my problem.
thanks in advance..
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

That statment is not valid transact SQL. I'm assuming this is how you bound variables using the old driver? Try binding using ?, e.g.:

and using setString and setDate accordingly.,


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
gunjaan titiyaa
Greenhorn

Joined: May 18, 2009
Posts: 3
Hi,
thanks for the reply. i have used exec wdcGetDataSummaryData $P{SerialNumberStr},$P{Date} in my jrxml file, while using ireport. and passing parameter as input from database. in java code i used exec wdcGetDataSummaryData ?,?... and i got exception at a time of filling report on line:
JasperPrint jp =
JasperFillManager.fillReport
(jasperMain, parameters, connection);
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

So what SQL is executed for DataSummaryReport_2 ?
gunjaan titiyaa
Greenhorn

Joined: May 18, 2009
Posts: 3
It Is calling stored procedure retriving data from database for the report and stored in temp table. once report is generated temp table is deleted. but here i am not able to generate report itself and getting exception related to statement. i am also facing problem that from where it is giving error
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

So what is the SQL for DataSummaryReport_2? The error message is telling you that there is something wrong with it.
Alexey Mitrov
Greenhorn

Joined: Jan 11, 2012
Posts: 1
gunjaan titiyaa wrote:Hi,
I switched my jdbc driver from type 2 to type 4, right now i m using microsoft sql server jdbc driver of type 4. so as i generate any report in my application it throws error like: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : DataSummaryReport_2

I am using stored procedure to retrieve data like: exec wdcGetDataSummaryData $P{SerialNumberStr},$P{Date}

I have migrated from jdk1.4 to 1.6.

can you please help me to solve my problem.
thanks in advance..


Hi!

This problem occure when using mssqljdbc4 driver. Replace it at your jasper server to jtds ms sql drivet - all will work fine. Driver is here: http://sourceforge.net/projects/jtds/files/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error executing sql statement