sql - Inner Join Statement Java -


the sql code runs fine in mysql, , other statements in application work 1 saying table dosn't exist when does, made sure syntax right don't understand why not working, code posted below

 private void salesreportbtnactionperformed(java.awt.event.actionevent evt) {                                                    try {         con = drivermanager.getconnection(url, user, password);         stmt = con.createstatement();         result = stmt.executequery("select prod_srv_id , `the_organizations_organization_name` ,"                 + " `prod_srv_details` , `prod_srv_price` , `prod_srv_discount` `contracts_contract_number` ,"                 + " `shipment_completed`\n"                 + "from product_and_services\n"                 + "join product_contract_line on product_and_services.prod_srv_id ="                 + " product_contract_line.product_and_services_prod_srv_id");         int tempname = 4;         salesreportlist.settext("");         string shipres;         while (result.next()) {             tempname = tempname + 1;             int prodid = result.getint("prod_srv_id");             string orgname = result.getstring("the_organizations_organization_name");             string details = result.getstring("prod_srv_details");             double price = result.getdouble("prod_srv_price");             double discount = result.getdouble("prod_srv_discount");             double contractnum = result.getdouble("contracts_contract_number");             int ship = result.getint("shipment_completed");             if(ship == 1)             {                 shipres = "true";             }             else{                 shipres = "false";             }             if (tempname >= 5) {                 salesreportlist.settext(salesreportlist.gettext() + "\n" + "   product id:   " + prodid + "   organization name:   " + orgname + "   details:   " + details + "   price:    " + price+ "   discount:    " + discount + "   contract number:    " + contractnum + "   shipment completed:    " + shipres );             } else {                 joptionpane.showmessagedialog(null, "error");             }         }     } catch (sqlexception ex) {         joptionpane.showmessagedialog(null, ex.getmessage());     } }             

looks space or comma issue in query.the best way solve print query , try executing printed query in sql client.

looks comma missing between prod_srv_discount contracts_contract_number

hope should solve issue.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -