Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / November 2005

Tip: Looking for answers? Try searching our database.

oracle BLOB putbytes deprecated.. what should I use?

Thread view: 
arashamiri@hotmail.com - 02 Nov 2005 14:40 GMT
Hi!
I use the BLOB.putBytes(pos, buf) method to write chunkwise from an
inputstream to a new BLOB before writing it to a database.

<sample code>
BLOB blob = BLOB.createTemporary(con, false, BLOB.DURATION_SESSION);
blob.open(BLOB.MODE_READWRITE);

byte[] binaryBuffer;
long position;
int chunkSize = 0;
int bytesRead = 0;
int bytesWritten = 0;

try {
 chunkSize = blob.getChunkSize();
 binaryBuffer = new byte[chunkSize];

 position = 1;

 while ( (bytesRead = in.read(binaryBuffer)) != -1) {
   bytesWritten = blob.putBytes(position, binaryBuffer);
   position += bytesRead;
 }
} catch (Exception e) {
 //some error handling...
}
</sample code>

This method seems to be deprecated...
what should i use instead??

greetings, arash.
HansF - 04 Nov 2005 06:42 GMT
You don't mention the version of Oracle you use.   So ... I suggest you go
to the Oracle documentation for whatever version, look up the "Application
Developer's Guide - Large Objects" manual, search the table of contents
for "Using Java (JDBC) to Work with LOBs" in which they have a table
showing the JDBC 3.0 equivalent.

Docs at http://docs.oracle.com >> database + version >> View Library >>
"List of Books" link or "Books" tab >> App...

Signature

Hans Forbrich                          
Canada-wide Oracle training and consulting
mailto: Fuzzy.GreyBeard_at_gmail.com  
*** Top posting relies guarantees I won't respond. ***



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.