I am facing a wierd problem dealing with jdbc. I am using normal Statement and PrepareStatement in my question.
My program flow is like ,
Connection con = createConnection();
Statement stmt = con.CreateStatement();//con is a valid
PreparedStatement pstmt = con.prepareStatement(sqry);
Resultset rs1 = stmt.executeQuery(sfirstQry);
String data = rs1.getString(1);
Resultset rs2 = pstmt.executeQuery();
String data1 = rs2.getString(1);
This program runs fine sometimes, but sometimes it gives invalid statement sql exception. I don't know what I am doing wrong. Can somebody tell me what I am doing wrong??