Statement stm ;
ResultSet rr=null;
String qu = "SELECT * FROM Pdet";
stm = connn.createStatement();
rr = stm.executeQuery(qu);
String nn = rr.getString("pid");
JOptionPane.showMessageDialog(null, nn);
IS THERE any problem with the code ? what i think is that there is a problem with the query, the message box doesn't run !
while(rr.next()) {
String nn = rr.getString("pid");
....
The ResultSet is a pointer initially directed before the first row of your result rows. You need to point to your results via call(s) with the ResulSet interface's next() method: http://docs.oracle.com/javase/tutorial/jdbc/basics/processingsqlstatements.html