-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Howto store large binary files in Oracle database using H?
PostPosted: Mon Apr 24, 2006 9:27 am 
Newbie

Joined: Mon Dec 26, 2005 7:58 am
Posts: 9
Hi,
I would like to know what is the best approach to store a big binary file, say 20-30 MB in Oracle 10g database using hibernate.

My current approach is:
1) In the pojo file I will write:
Code:
private Blob content;

And…
Code:
public void setContent(byte[] buffer)
{
  if( buffer != null && buffer.length > 0 ) {
    content = Hibernate.createBlob(buffer);
  }
}

2) In the hbm.xml file I will write:
Code:
<property
           length="31457280"
            name="content"
            type="blob"
            update="true"
            insert="true"
            access="property"
            column="CONTENT"
            not-null="false"
            lazy="true"
/>

3) Creating the table in (oracle) database is done by the following sql fragment:
Code:
create table BINARY_FILE_TBL (ID number(10,0) not null, CONTENT blob,…


Although the above code is working, I do not know if it optimized and maybe there is a better way to handle insertion and retrieving LOTS and LARGE binary files.

BTW: I also used a tablespace
Code:
(create tablespace binTB
  logging
  datafile 'binTB.dbf'
  size 128m
  autoextend on
  next 32m maxsize unlimited
extent management local; )
in oracle database specific for that binary table.

I am using Hibernate 3.1 rc2, Oracle 10.2g (with thin driver)

Please, any comment will be appreciated.
THANKS.
simon.


Top
 Profile  
 
 Post subject: Try the latest driver
PostPosted: Tue Aug 01, 2006 8:17 am 
Newbie

Joined: Wed Jul 26, 2006 2:48 am
Posts: 2
Location: Bangalore
I also faced similar issue.
I downloaded the latest Oracle Drivers (10G) and used it. The problem was resolved. May be you want to try that


JassonBourne

---If you find it useful, do rate the answer.

_________________
-------------------
Dont Try to be a man of importance.
Try to be a man of value.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.