Jump to content
We've recently updated our Privacy Statement, available here ×

SQL Exception Escape Sequence


ktrinad

Recommended Posts

By: Danny Liu - dsyliu

SQL Exception Escape Sequence

2003-06-19 08:18

Hi all,

 

I use iReport 0.1.0 and my sql statement is "select * from vehicle where customer_uk = $P{customer}" where $P{customer} is Integer. It's successfully compiled but I got the following error message:

 

Opening connection....

 

Executing query select * from vehicle where customer_uk = $P{customer}

 

java.sql.SQLException: JZ0S8: An escape sequence in a SQL Query was malformed: '{customer}'.

 

at com.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java)

 

at com.sybase.jdbc.Escape.<init>(Escape.java)

 

at com.sybase.jdbc.EscapeTokenizer.next(EscapeTokenizer.java)

 

at com.sybase.jdbc.SybStatement.processEscapes(SybStatement.java)

 

at com.sybase.jdbc.SybStatement.doEscapeProcessing(SybStatement.java)

 

at com.sybase.jdbc.SybStatement.executeQuery(SybStatement.java)

 

at IReportCompiler.main(IReportCompiler.java:145)

 

 

 

Abnormal termination!

 

Can anybody help me?

 

Thank you,

dsyliu

 

 

 

 

By: Giulio Toffoli - gt78

RE: SQL Exception Escape Sequence

2003-06-19 09:21

When you leave the query in the query field of the compiler form, iReport execute the query AS IS.

To force the execution of the query by the JR engine (that evaluate all aparameters, etc...), leave the query field of iReport compiler form blank.

 

Giulio

 

 

 

 

By: Danny Liu - dsyliu

RE: SQL Exception Escape Sequence

2003-06-19 10:18

Giulio,

 

Sorry I don't quite get what you mean. Are you saying that I don't need to enter a query at all? How can that be possible??

 

dsyliu

 

 

 

 

By: Giulio Toffoli - gt78

RE: SQL Exception Escape Sequence

2003-06-19 11:51

ok.

I assume that you are working with iReport 0.1.0.

You have 2 palces where put a query:

1. In the database form (the form where you can retrive database fields)

2. In the compiler form.

 

When you try to compile, iReport fill the query field of the compiler window with the report query (that you have specified in the "database form").

 

You have only to remove from the query field in the compiler window the query that iReport put.

In this way, JR will use the query stored for the report resolving parameters.

 

I hope that now is more clear.

 

Giulio

 

 

 

 

 

 

 

By: Danny Liu - dsyliu

RE: SQL Exception Escape Sequence

2003-06-19 12:50

Giulio,

 

I did it, and now I get this error msg:

 

Opening connection....

 

java.lang.AbstractMethodError

 

at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:411)

 

at dori.jasper.engine.fill.JRFiller.fillReport(JRFiller.java:115)

 

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:219)

 

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:159)

 

at IReportCompiler.main(IReportCompiler.java:151)

 

Abnormal termination!

 

Any idea? Thank you very much for your help.

dsyliu

 

 

 

 

By: Giulio Toffoli - gt78

RE: SQL Exception Escape Sequence

2003-06-19 13:53

 

There is a problem with your JDBC Deriver. Try to test it before use it in the compiler.

 

Giulio

 

 

 

 

By: Danny Liu - dsyliu

RE: SQL Exception Escape Sequence

2003-06-19 14:43

I could successfully run a non-parameterized report using the same JDBC driver, so I don't think there is a problem with the JDBC driver.

 

 

 

 

By: Giulio Toffoli - gt78

RE: SQL Exception Escape Sequence

2003-06-20 01:12

What iReport version?

 

 

 

 

By: Danny Liu - dsyliu

RE: SQL Exception Escape Sequence

2003-06-20 07:12

version 0.1.0

 

 

 

 

By: Danny Liu - dsyliu

RE: SQL Exception Escape Sequence

2003-06-23 08:57

Giulio,

 

Maybe I misunderstood the purpose of parameter. This is what I want to do: the ultimate goal is to create a webpage (form) where users can enter customer ID and submit it to the jasper report engine. The report will have a customer parameter, and retrieve data from the database for this particular customer. But before applying to web application, I want to try it on iReport. Can you please walk me thru step by step how to achieve it? Thank you very much.

 

dsyliu

 

 

 

 

By: Giulio Toffoli - gt78

RE: SQL Exception Escape Sequence

2003-06-24 02:49

 

What you want exactly know?

Use the wizard to create your initial report, then create a parameter (like IDCustomer), set the right class type (i.e. Integer) and add a default value (i.e. new Integer(3)). This default value is the only way to specify in iReport 0.1.0 a value for a parameter. iReport 0.2.0 will ask for it if the parameter is "is for prompting".

Modify your query to have something like:

 

SELECT * FROM CUSTOMERS WHERE IDCustomer = $P{IDCustomer}

 

Try to run your report.

 

Giulio

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...