File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes What is the best way to write to BLOB from servlet application running under JBoss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "What is the best way to write to BLOB from servlet application running under JBoss" Watch "What is the best way to write to BLOB from servlet application running under JBoss" New topic
Author

What is the best way to write to BLOB from servlet application running under JBoss

John Sims
Greenhorn

Joined: Jun 21, 2012
Posts: 2
Hi,

I am using this version of Oracle: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

I have a java servlet web application (jdk 1.6) and can't write to a BLOB column using the JBoss connection pool. I've tried several combinations of using java.sql.Blob and oracle.jdbc.BLOB with getUnderlyingResultset. I'm looking for some sample code or a best practice document on how to accomplish this seemingly simple task of writing to a BLOB.

I could post my code but not sure which version to post and thought there might be a best-practice on this.

Here's one of the many exceptions I've gotten using various attempts:

10:16:55,331 INFO [STDOUT] 10:16:55,331 ERROR CommitAttachDocument - Error encountered while uploading file
java.lang.ClassCastException: oracle.jdbc.driver.OracleResultSetImpl cannot be cast to oracle.jdbc.OracleResultSet
at pfizer.vre.at.os.ConnectionToADB.writeBLOBAttachmentNew(ConnectionToADB.java:3201)
at pfizer.vre.at.os.ConnectionToADB.commitAddAttachment(ConnectionToADB.java:3164)
at pfizer.vre.at.os.ObjectServer.commitAddAttachment(ObjectServer.java:709)
at pfizer.vre.at.servlets.CommitAttachDocument.service(CommitAttachDocument.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

...etc...


Can someone please provide a sample or link to a best practice document?

thanks!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9327
    
110

Are you packaging the JDBC driver jar within your application? If yes, then remove it from there. The driver jar is expected to be in JBOSS_HOME/server/<servername>/lib folder.

[My Blog] [JavaRanch Journal]
John Sims
Greenhorn

Joined: Jun 21, 2012
Posts: 2
Jaikiran,

Thanks for providing the answer. That solved the problem! I was packaging the ojdbc14.jar with my application. In addition to that, I discovered an older version of an ojdbc14.jar file in the JBOSS_HOME/server/<servername>/lib folder. I removed the older version and replaced it with the ojdbc14.jar compatible with 10.2 of Oracle.

Thanks again for resolving this - I was looking in the wrong direction!

-john
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the best way to write to BLOB from servlet application running under JBoss
 
Similar Threads
vvvv urgent - Scanning and saving documents into oracle db with Twain
Oracle JDBC Driver
Servlet + Oracle9Ii help needed
Unsupported feature
Saving Japanese Characters in Oracle Blob using Java program