Jump to content

error when using 'where_clause' as parameter


Recommended Posts

By: elis - pelis

error when using 'where_clause' as parameter

2002-12-12 07:19

Hi Teodor,

 

I tried you suggestion replacing '-' with '_' in where_clause but still I get an SQLException.

The error should be in the 'where_clause' or the way I include it in the 'qyeryString' in xml file because when I run the same query (replacing the $!P{where_clause} with the real values it runs fine.

Here's my code:

<parameter name="where_clause"

class="java.lang.String"/>

<queryString>

select

pp.field_2 TRANSIT,

pp.field_3 ACCOUNT,

pp.field_4 CYCLE,

pp.field_20 GROUP_NO,

pp.field_21 GROUP_NAME,

pp.field_25 COURIER,

pp.field_29 FAX,

pp.field_31 FAX_NUMBER

 

from public_properties pp

$P!{where_clause}

group by pp.field_2, pp.field_3, pp.field_4, pp.field_20, pp.field_21, pp.field_25,

pp.field_29, pp.field_31

order by pp.field_2

<queryString>

 

The 'where_clause' that I build in my application is:

 

String where_clause= "where pp.field_1 = " +

transit + " and pp.field_2 = " + account;

 

The exception I get is:

java.sql.SQLException: [Microsoft][sqlServer 2000 Driver for JDBC]Unexpected end of escape, line 0 offset 0.

 

at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)

 

at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)

 

at com.microsoft.jdbc.base.BaseEscapeTranslator.parseEscape(Unknown Source)

 

at com.microsoft.jdbc.base.BaseEscapeTranslator.translateEscape(Unknown Source)

 

at com.microsoft.jdbc.base.BaseSQLEscapeProcessor.visit(Unknown Source)

 

at com.microsoft.jdbc.base.BaseSQLTreeTraverser.visit(Unknown Source)

 

at com.microsoft.jdbc.base.BaseSQLTreePreOrderTraverser.traverse(Unknown Source)

 

at com.microsoft.jdbc.base.BaseSQLTreePreOrderTraverser.traverse(Unknown Source)

 

at com.microsoft.jdbc.base.BaseSQLEscapeProcessor.processEscapes(Unknown Source)

 

at com.microsoft.jdbc.base.BaseSQL.translateEscapes(Unknown Source)

 

at com.microsoft.jdbc.base.BaseSQL.processSQL(Unknown Source)

 

at com.microsoft.jdbc.base.BaseSQL.<init>(Unknown Source)

 

at com.microsoft.jdbc.base.BaseStatement.preProcessSQL(Unknown Source)

 

at com.microsoft.jdbc.base.BasePreparedStatement.<init>(Unknown Source)

 

at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source)

 

at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source)

 

at dori.jasper.engine.util.JRQueryExecuter.executeQuery(JRQueryExecuter.java:136)

 

at dori.jasper.engine.util.JRQueryExecuter.executeQuery(JRQueryExecuter.java:80)

 

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

 

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

 

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

 

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

 

at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:616)

 

at StListReportCompiler.<init>(StListReportCompiler.java:41)

 

at StListReportCompiler.main(StListReportCompiler.java:273)

 

 

NESTED BY :

 

dori.jasper.engine.JRException: Error executing report query :

 

Can you please tell me from the exception which part of my code could be wrong?

 

Thanks,

Elis

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...