Hi, I'm trying simple loading of an image file into Oracle as a Blob, but keep getting the error:ORA-01002: fetch out of sequence. The code is as follows: BLOB blob = null; stmt.execute("CREATE TABLE img (name varchar(10), data blob)"); stmt.execute("INSERT INTO img VALUES ('test', empty_blob())"); stmt.execute("commit"); String cmd = "SELECT * FROM img WHERE name='test' FOR UPDATE"; ResultSet rset = stmt.executeQuery(cmd); while(rset.next()) blob = ((OracleResultSet)rset).getBLOB(2); What am I doing wrong?? Please help! Thanks.
taken from the oracle docs: Error Message: "ORA-01002: fetch out of sequence" A JDBC Connection by default has the AutoCommit turned ON. However, to use a SQL that has 'for update' you need to have autoCommit to be turned OFF. Hence, the solution is to set autocommit to false. http://otn.oracle.com/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#_18_ Jamie