File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
John Sims
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
John Sims
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic