Li_ma 2008-03-09 08:09:19
I’m writing a Java program which needs to save some big binary data
into different DB. I’m trying to make my code DB-independent, so it
can be migrated to as many DBMS as possible. At least now, I hope it
is compatible with MS SQL, Sybase, Oracle, DB2.
Now come back to the binary data, the obvious way to store it in DB is
by a BLOB(IMAGE for some cases). I have tested using
PreapredStatement.setBinaryStream() to save in Sybase and MS SQL. But
for Oracle, there’s limit of 4K bytes for BinaryStream. Seams like I
have to use BLOB to work for Oracle.
Since I cannot predict what kind of DB client will run my application
on, I hope I can find a general way that can handle binary data
correctly on at least all the major DBMS mentioned above.
I cannot use JDO or Hibernate as persistence layor for now. Maybe will
in the next version. Any work around for my current work?
Thanks a lot!