0

Am getting the following error when inserting a BLOB object to an Oracle Database table. It does not happen to all BLOB objects. While inserting a huge number of objects, most of them gets inserted before the error is thrown. So I can guarantee that the table does exist.

We are inserting data by plainly saving the hibernate entity. No Prepared Statements are used. I have found this post regarding the same error while using Prepared Statements. Can anyone please provide a reason and a possible solution for this issue when using plain hibernate entities and session.

java.sql.SQLException: ORA-00942: table or view does not exist
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289) 
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573) 
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1889)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940) 
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout>>       (OracleStatement.java:2709)
    at     oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
    at quotecopy.DbConnection.insertIntoDestinationDb(DbConnection.java:591)
    at quotecopy.QuoteCopier.main(QuoteCopier.java:72) 
Community
  • 1
  • 1
Nikhil Kuriakose
  • 1,101
  • 2
  • 10
  • 22

1 Answers1

1

Check if your table name is correct. If it's correct then check if the DB login/user
(which you use to connect to Oracle) has the proper permissions to access this table.

peter.petrov
  • 38,363
  • 16
  • 94
  • 159
  • I am able to insert values in the table. I have tried setting the BLOB values to null and it runs fine – Nikhil Kuriakose Jan 08 '15 at 14:01
  • What do you mean by "I am able"? Do "you" use the same login from the Java code, and when inserting the records as a test? – peter.petrov Jan 08 '15 at 14:02
  • I agree with peter.petrov. The OS user running the java code and your interactive login may not be the same user. Like, if you are logging in with '""/""@$SID as sysdba' then of course you can hit the table. However, your application user in the database is probably not a sys-level user (i hope) so needs grants applied to access the table. – suiterdev Jan 08 '15 at 14:09
  • Guys, I am persisting a managed entity using Hibernate. One of the fields corresponds to a sql blob object. I have tried the following. 1) Set the object to null 2) Convert an empty file to Blob . Both the cases, the blob is persisted to database. However, if I use a slightly larger file, I get the error mentioned above. Plus, if i ditch the managed entity altogether and use a prepared statement, it works fine. I am wondering what is different in hibernate session when i use a managed entity!! – Nikhil Kuriakose Jan 08 '15 at 14:16