Exception in thread "main" java.sql.SQLException: Method 'executeQuery(String)' not allowed on prepared statement.
public Object getObject() throws SQLException, IOException, ClassNotFoundException
{
PreparedStatement ps;
String sql="select * from student";
ps=con.prepareStatement(sql);
ResultSet rs=ps.executeQuery(sql);
Student newStudent=null;
while(rs.next())
{
try (ByteArrayInputStream bais = new ByteArrayInputStream(rs.getBytes("description"))) {
ObjectInputStream obis;
obis = new ObjectInputStream(bais);
newStudent=(Student)obis.readObject();
}
}
return newStudent;
}
Can anyone tell me how to resolve this issue ?