aspose file tools*
The moose likes JDBC and the fly likes Problem retrieving BLOB through resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem retrieving BLOB through resultset" Watch "Problem retrieving BLOB through resultset" New topic
Author

Problem retrieving BLOB through resultset

Laryssa Fernandes
Greenhorn

Joined: Apr 14, 2011
Posts: 5
Hi,

I have a table in Oracle with BLOB data. When I try to retrieve the data using
ResultSet rs=st.executeQuery("SELECT * from NodeTable");

It gives an exception. If I put only the non BLOB column name in the SQL statement, there is no error. But if I put the BLOB column name, it gives the same error as above.
The stack trace is as below:

java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6986)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
at summ.Main.main(Main.java:79)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18154
    
    8

That would be because the JDBC-ODBC driver doesn't support BLOB columns. But you're using an Oracle database, right? Then why not use the Oracle JDBC driver which goes with it? That driver would surely support BLOBs.
Brian Enochson
Greenhorn

Joined: Apr 12, 2011
Posts: 14

Also retrieving a blob takes special handling. Here is some example code I have used, there are probably many examples out there if you want to Google them. And Paul is right, you want to use the Oracle JDBC Driver if your application is always going to use Oracle.




Brian
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem retrieving BLOB through resultset
 
Similar Threads
Simple JDBC question
select works in db, but not across jdbc...
java.sql.SQLException: Invalid handle
jdbc error: Invalid Descriptor Index
Data source name not found and no default driver specified