2010-09-08 3 views
1

Ceci est l'erreur que je suis arrivé lors de la compilation du fichier jrxml:JasperReports: Erreur lors de l'exécution de l'instruction SQL pour

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

Comme par le message d'erreur, j'ai vérifié la ligne 38 dans le fichier xml, il est:

<![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`]]> 

Comme pour les messages d'erreur que j'ai vérifié la ligne n °: 38 dans le fichier xml et je ne pouvais trouver aucun problème avec la requête, j'utilise NetBeans plug-in pour générer le rapport. Ce problème a commencé après avoir changé le type de customer_details.TIN de bigint à varchar. J'ai vérifié le fichier xml et fait que le TIN est de 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> 

Répondre

1

vérifier le manuel qui correspond à votre version du serveur MySQL pour la bonne syntaxe à utiliser à proximité « « temp_bill » temp_bill, "customer_details" customer_details OÙ temp_ » à ligne 38

Lorsque MySql vous dire voir à la ligne 38, cela signifie que la ligne 38 depuis le début de la phrase SQL

Je pense que vous devriez examiner ceci:

DE "temp_bill" temp_bill, "customer_details"

-ce que ces guillemets nécessaires? essayer de les enlever :)

+0

Merci beaucoup cela a fonctionné ... – moshe

Questions connexes