开发者

JasperReports: Error executing SQL statement for

开发者 https://www.devze.com 2023-01-15 00:44 出处:网络
This is the error I got while compiling the jrxml file: Compiling to file... /home/moshe/NetBeansProjects/Billing/src/billing/report2.jasper

This is the error I got while compiling the jrxml file:

Compiling to file... /home/moshe/NetBeansProjects/Billing/src/billing/report2.jasper
Compilation running time: 299! 
Filling report...
Locale: English (India)
Time zone: Default
Error filling print... Error executing SQL statement for : report2 
net.sf.jasperreports.engine.JRException: Error executing SQL statement for : report2
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:143)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:686) 
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:606) 
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1277) 
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:897) 
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:841)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)
at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:877)
at org.openide.util.RequestProcessor$Task.run(Unknown Source) 
at org.openide.util.RequestProcessor$Processor.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to usenear '"temp_bill" temp_bill,      "customer_details" customer_details WHERE      temp_' at line 38
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
... 11 more 
Print not filled. Try to use an EmptyDataSource...

As per the error message, I checked the line 38 in the xml file, it is:

<![CDATA[SELECT
     temp_bill.`bill_number`AS temp_bill_bill_number,
     temp_bill.`sl_no`AS temp_bill_sl_no,
     temp_bill.`cust_id`AS temp_bill_cust_id,
     temp_bill.`cust_name`AS temp_bill_cust_name,
     temp_bill.`date`AS temp_bill_date,
     temp_bill.`item_code`AS temp_bill_item_code,
     temp_bill.`item_name`AS temp_bill_item_name,
     temp_bill.`tax`AS temp_bill_tax,
     temp_bill.`unit_price`AS temp_bill_unit_price,
     temp_bill.`quantity`AS temp_bill_quantity,
     temp_bill.`gross_value`AS temp_bill_gross_value,
     temp_bill.`cash_discount`AS temp_bill_cash_discount,
     temp_bill.`net_value`AS temp_bill_net_value,
     temp_bill.`qty_discount`AS temp_bill_qty_discount,
     temp_bill.`net_total`AS temp_bill_net_total,
     temp_bill.`cess`AS temp_bill_cess,
     temp_bill.`tot_tax`AS temp_bill_tot_tax,
     temp_bill.`grand_total`AS temp_bill_grand_total,
     temp_bill.`remarks`AS temp_bill_remarks,
     temp_bill.`billingAddress`AS temp_bill_billingAddress,
     temp_bill.`tot_in_words`AS temp_bill_tot_in_words,
     temp_bill.`deliv_note_no`AS temp_bill_deliv_note_no, 
     //line 38  is the next line*************************
     temp_bill.`deliv_note_date`AS temp_bill_deliv_note_date,
     temp_bill.`purchase_order_no`AS temp_bill_purchase_order_no,
     temp_bill.`purchase_order_date`AS temp_bill_purchase_order_date,
     temp_bill.`despatch_document_no`AS temp_bill_despatch_document_no,
     temp_开发者_如何学运维bill.`despatch_document_date`AS temp_bill_despatch_document_date,
     temp_bill.`terms_of_delivery`AS temp_bill_terms_of_delivery,
     customer_details.`TIN`AS customer_details_TIN,
     customer_details.`cstRegNo`AS customer_details_cstRegNo,
     customer_details.`phone_land`AS customer_details_phone_land,
     customer_details.`phone_mob`AS customer_details_phone_mob,
     customer_details.`fax`AS customer_details_fax,
     customer_details.`email`AS customer_details_email,
     customer_details.`cust_id`AS customer_details_cust_id FROM
     "temp_bill" temp_bill,
     "customer_details" customer_details WHERE
     temp_bill.`cust_id` = customer_details.`cust_id`]]>

As per the error messages I checked the line no: 38 in the xml file and i could not find any problem with query, I use NetBeans plugin to generate the report. This problem started after I changed the type of customer_details.TIN from bigint to varchar. I've checked the xml file and made sure the TIN is of type varchar

<textField>
    <reportElement x="27" y="77" width="241" height="11"/>
    <textElement textAlignment="Center" markup="none">
        <font size="8"/>
        </textElement>
        <textFieldExpression class="java.lang.String"><![CDATA[$F{customer_details_TIN}]]></textFieldExpression>
 </textField>


check the manual that corresponds to your MySQL server version for the right syntax to use near '"temp_bill" temp_bill, "customer_details" customer_details WHERE temp_' at line 38

When MySql tell you to see at line 38, it means line 38 from the start of the SQL sentence

I think you should review this:

FROM "temp_bill" temp_bill, "customer_details"

Are these quotation marks needed? try to remove them :)

0

精彩评论

暂无评论...
验证码 换一张
取 消