This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem retrieving BLOB through resultset" Watch "Problem retrieving BLOB through resultset" New topic

Problem retrieving BLOB through resultset

Laryssa Fernandes

Joined: Apr 14, 2011
Posts: 5

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(
at sun.jdbc.odbc.JdbcOdbc.standardError(
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(
at sun.jdbc.odbc.JdbcOdbcStatement.execute(
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(
at summ.Main.main(
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

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

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.

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