Jon Thoms
Jon Thoms

Reputation: 10797

Java ResultSet Method to Get Oracle RAW Type

I have a result set returned by a select query to an Oracle DB. One of the returned rows is of the RAW type. Based on what I can tell from the Database JDBC Developer's Guide, RAW maps to Java's byte[] type, which indicates that I should use ResultSet's getBytes() method. This is the first time that I have used Oracle's RAW type, I was wondering if getBytes() is indeed the way to go or if another retrieval method (other than getBytes()) is a more appropriate choice. I've tried Googling and searching for other SO questions, some of which seem to suggest getBytes(), but nothing definitive. Thanks.

Upvotes: 2

Views: 2083

Answers (1)

Jan
Jan

Reputation: 13858

As RAW can only contain 2000 bytes of data (according to oracle documentation) you can safely retrieve it using getBytes(). It's also possible to process with getBinaryStream() - but given the comparatively small memory footprint I'd advise againt that.

Upvotes: 4

Related Questions