Here is the code that I try to execute but it fails with an error. Can you please explain me where is my mistake
try{
Class.forName("java.sql.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/NAgency","root","bhumika");
Statement sta = con.createStatement();
String Paper_ID,NOP,Price,Pages,L,q,x; Integer p=0;
x = jTextField1.getText();
q = "Select * From NPaper Where Paper_ID =" + x;
ResultSet res = sta.executeQuery(q);
if (res.first()==true){
p=Integer.parseInt(res.getString("Paper_ID"));
NOP = res.getString("NOP");
Pages = res.getString("Pages");
Price = res.getString("Price");
L= res.getString("Lang1");
jTextField2.setText(" "+p);
jTextField3.setText(NOP);
jTextField4.setText(Pages);
jTextField5.setText(Price);
jTextField6.setText(L);
}else{
JOptionPane.showMessageDialog(null, "Invalid Paper_ID");
}
}catch (Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}