sqlexception « JDBC « Java Database Q&A

1. how to use prepared statement in following case?    stackoverflow.com

I have following database schema for tabel tblpers

Field      Type         Null    Key     ...

2. What does "if (rs.next())" mean?    stackoverflow.com

I am currently getting the error,

java.sql.SQLException: Method 'executeQuery(String)' not allowed on prepared statement.
because I am using
PreparedStatement stmt = conn.prepareStatement(sql);
and also had
ResultSet rs = stmt.executeQuery(sql);
in my code. I now need to remove the ...

4. preparedstatement throws sqlexception    coderanch.com

I have a code to upload file to database. I use preparedstatements. When I run the code, i am able to upload text files. If i choose any images or other files a SQLException is thrown. String contentType = image.getContentType(); String fileName=image.getFileName(); int size = image.getFileSize(); String data = null; IDatabase idb; try { byte[] imagedata=image.getFileData(); ByteArrayInputStream bais=new ByteArrayInputStream(imagedata); idb=new Connect(); ...