Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any datatype to store files of size greater than 20k

 
sowjan kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Iam having 2 fields in my table to store files. BLOB can insert files of size < 4k and update files of size <2k. CLOB can do both insert and update of files <4k. LONG RAW datatype is not suporting 2 fields in the same table...Any ideas as how to implement a datatype for 2 fields where i can store files of size greater than 20k will be most welcome

Sowjanya
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which DataBase are you using? Because if it is Oracle a BLOB can store <4 Gigabytes of data, not < 4Kb. Typically too - again if you are using Oracle - you shouldn't use the LONG RAW datatype. BLOBs can store double the amount of data than LONG RAW ( <4Gb rather than < 2Gb). You can have multiple BLOBs in one table, but only one LONG RAW. Also BLOBs support random access to data whereas LONGs only support sequential access.
[ March 16, 2005: Message edited by: Paul Sturrock ]
 
sowjan kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul,
Yeah..At last I fould a solution by having BLOB as such..As u said Iam using oracle database. The following is the code i used

insert into blob_details values(empty_blob(),empty_blob()) //initially i inserted an empty blob. No matter whether BLOB datatype in oracle is declared as NULL or NOT NULL.. we can follow this one..Then for updation of BLOB

select blob,blob_tree from blob_details where id=? for update

prepareStmt = con.prepareStatement (sql,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
.
.
.
con.setAutoCommit(false);
...
...//all necessary stream operation
...
con.commit ();//done after closing the streams...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic