java - Mysql table not found -


here query along java code..

 public arraylist getproductinfo(int id){       try{         string query="select product_name,product_description product category_id = "+id;         statement = connect.createstatement();         result = statement.executequery(query);         system.out.println("successfull query info..");     }catch(exception e){         system.out.println("error in query..");         e.printstacktrace();     }      arraylist<string> columnname = null;     try{         columnname = new arraylist<string>();          for(int = 1 ; <= result.getmetadata().getcolumncount(); i++){                 columnname.add(result.getmetadata().getcolumnname(i));             }     }catch(exception e){         e.printstacktrace();     }     return columnname;  } 

this function called one:

private void jbutton3actionperformed(java.awt.event.actionevent evt) {                                              // todo add handling code here:           jtable1.removeall();     jtable1.setmodel(new javax.swing.table.defaulttablemodel(      new object [][] { }, null ));      defaulttablemodel model = (defaulttablemodel) jtable1.getmodel();     mydatabasehandler db=new mydatabasehandler();     db.setconnection(null, null, null);     arraylist content=db.getproductinfo(1);     model.addcolumn("image");     model.addcolumn("description");     object[] rows=new object[2];     resultset result=db.getrset();      try{        while(result.next()){            string ss="";             int m=0;            for(object c : content){               m++;               if(m==1){                   //rows[0]=result.getblob(c.tostring());                   rows[0]=result.getstring(c.tostring());               }else if(m==2){                   ss+="name:"+result.getstring(c.tostring()+"\n");               }else if(m==3){                   ss+="description:"+result.getstring(c.tostring()+"\n");               }else if(m==4){                   ss+="price:"+result.getstring(c.tostring()+"\n");               }else if(m==5){                   ss+="quantity:"+result.getstring(c.tostring());               }           }            rows[1]=ss;             //system.out.println(ss);             model.addrow(rows);         }    }catch(exception e){         e.printstacktrace();     } }            

this executes should in cmd whenever run java class gives me error:

java.sql.sqlexception:column'product_description' not found 

note: query works in cmd fine , column product_description there , there no mistake in spelling.if give 1 column name after select string such select product_description executes normally...what doing wrong? in advance.

'product_description' column name - not table name. apparently either don't have such column or have mistake in name.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -