title: JasperReports: Error executing SQL statement for
body: <p>This is the error I got while compiling the jrxml file:</p>
  
  <pre><code>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...
  </code></pre>
  
  <p>As per the error message, I checked the line 38 in the xml file, it is: </p>
  
  <pre class="lang-sql prettyprint-override"><code>&lt;![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`]]&gt;
  </code></pre>
  
  <p>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 <em>NetBeans</em> plugin to generate the report. This problem started after I changed the type of customer_details.TIN from <em>bigint</em> to <em>varchar</em>. I've checked the xml file and made sure the TIN is of type <em>varchar</em></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;textField&gt;
      &lt;reportElement x="27" y="77" width="241" height="11"/&gt;
      &lt;textElement textAlignment="Center" markup="none"&gt;
          &lt;font size="8"/&gt;
          &lt;/textElement&gt;
          &lt;textFieldExpression class="java.lang.String"&gt;&lt;![CDATA[$F{customer_details_TIN}]]&gt;&lt;/textFieldExpression&gt;
   &lt;/textField&gt;
  </code></pre>