aspose file tools*
The moose likes JDBC and the fly likes java.sql.SQLException: Unsupported feature Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: Unsupported feature" Watch "java.sql.SQLException: Unsupported feature" New topic
Author

java.sql.SQLException: Unsupported feature

Christopher Elkins
Ranch Hand

Joined: Oct 26, 2004
Posts: 45
I'm getting a "java.sql.SQLException: Unsupported feature" exception when I try to update the contents of a BLOB in an Oracle 9i database.

Here's some background. The application uses an Oracle thin client to connect to the database. I create a SCROLL_INSENSITIVE/READ_ONLY statement and use it to insert a record into the dB table. I then retrieve a "pointer" to the BLOB column in the table and use an OutputStream to try and write data of type byte[] to the BLOB. This is where it blows up.

Any help?


Christopher Elkins, SCJP Java 2 Platform
Christopher Elkins
Ranch Hand

Joined: Oct 26, 2004
Posts: 45
Still looking for help.

I've narrowed it down to the following statement:
,where b is an instance of java.sql.Blob.



I've looked everywhere I can think of for an answer. Please help, I'm giving myself a migraine here.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30957
    
158

Christopher,
Does it work if you use a different getter? Like the one that gets a byte array?

Are you using the standard classes12.zip driver?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Christopher Elkins
Ranch Hand

Joined: Oct 26, 2004
Posts: 45
I'm using the ojdbc14.jar to define oracle classes. I tried the following code and received a java.lang.ClassCastException at line 17.

Not sure why that occured since I'm pretty sure a java.sql.Blob should be castable to an oracle.sql.BLOB. Whatever, I then tried your suggestion and ran the following code.

I received the ever so irritating java.sql.SQLException: Unsupported feature at line 17.

I've looked through the API and I can't find anything wrong with what I'm trying to do. This is my current task so I'll keep plugging away, but any further help would be tremendously appreciated.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30957
    
158

Christopher,
I misread the question (sorry about saying getter instead of setter.)

The easiest way to see what class you have is:

Then you can compare to the hierarchy to see what is going wrong with the case.

You shouldn't have to cast to an Oracle specific type at all though. The Blob interface has the method:

which returns an OutputStream like the one you are trying to get.
Christopher Elkins
Ranch Hand

Joined: Oct 26, 2004
Posts: 45
Thanks for your help Jeanne. I finally got it working. Just so everyone can benefit from my recent agony this is what I did:
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30957
    
158

And thank you for sharing the solution!
dheeraj chhabra
Greenhorn

Joined: Apr 09, 2004
Posts: 23
I am using thin driver and I am getting unsupported exception on line #2 in setPlsqlIndexTable() method.

Our SQL is not very large. For reference find the code snippet here.
-----------------------------------------------------------------------
1. OracleCallableStatement load=null;
load = (OracleCallableStatement) con.prepareCall (
"{call pm4.pminsert4(?,?,?,?,?,?,?,?,?)}"
);
2.load.setPlsqlIndexTable (1,deviceType, max, max, OracleTypes.NUMBER, 0);
3.load.setPlsqlIndexTable (2,neName, max, max, OracleTypes.NUMBER, 0);
4.load.setPlsqlIndexTable (3,tpName, max, max, OracleTypes.NUMBER, 0);
5.load.setPlsqlIndexTable (4,layerRate, max, max, OracleTypes.NUMBER, 0);
6.load.setPlsqlIndexTable (5,location, max, max, OracleTypes.NUMBER, 0);
7.load.setPlsqlIndexTable (6,granularity, max, max, OracleTypes.NUMBER, 0);
8.load.setPlsqlIndexTable (7, zeroSupr, max, max, OracleTypes.NUMBER, 0);
9.load.setPlsqlIndexTable (8, gmtDate, max, max, OracleTypes.NUMBER, 0);
10.load.setInt(9, batchSize);
-----------------------------------------------------------------------


We are using jdk1.4 with ojdbc14.jar.

Please let me know what can be the issue.

Thanks and Regards
Dheeraj
 
wood burning stoves
 
subject: java.sql.SQLException: Unsupported feature