I'm using CMP entity beans. Particularly to achieve database transparency
and to avoid writting all of the db access code.

Do you know how to do it with CMP?

-----Original Message-----
From: David Ward [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 2:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Store large pdfs with JBoss


I have been able to put CLOBs and BLOBs into Oracle 9i using JBoss 
3.0.4, though admittedly after jumping through several hoops.

1) yes, ejb's aren't supposed to do i/o - I do my work delegated from 
the servlet level.

2) You have to have autocommit off.  For some reason autocommit is on by 
default in JBoss 3 (wasn't in 2.4) from Connections from DataSources. 
Please someone tell me how to turn this off in a global config somewhere!

3) You have to first insert a row using an empty lob.  For example,
insert into my_table (key, data) values ('1', empty_blob())
.  You could have used empty_clob() if you were using CLOBS instead of 
BLOBS.

4) You can then update the BLOB, hower you have to re-select *** using 
select for update ***.  If you don't use select for update, ** it won't 
work **.  For example,
select data from my_table where key = '1' for update

5) You then can update the BLOB from the ResultSet.  Notice I said 
oracle.sql.BLOB not java.sql.Blob. I had to use an Oracle-specific type 
here.  I couldn't get it to work any other way, and I spent hours (no, 
setBinaryStream does not work)...  For example,
BLOB blob = (BLOB)rs.getBlob(1);
BufferedOutputStream bos =
     new BufferedOutputStream( blob.getBinaryOutputStream() );
// write to the output stream
// safely close everything up

6) Don't forget to commit the work you did.  This will commit the insert 
and the data your wrote to your BLOB.

7) I set the autocommit on the Connection back to what it was when I 
first got it from the DataSource, before I close it (the Connection, 
which returns it to the pool).  Again, I'd like to see autocommit off 
since I wrap everything in a UserTransaction and it should be committed 
there instead...

Hope this will save you some of the painful time I had to go through if 
you decide to go this route.

David

--


Luttrell, Peter escribió::
> Has anyone had experience storing large pdfs with jboss, say ~5mbs each?
>  
> I would like to do it with Oracle and BLOBs, but i've read that there's 
> problems with the drivers and jboss and it doesn't look like it will be 
> possible.
>  
> Has anyone done with with any other database?
>  
> Does anyone have ideas on how else to store these files, maybe without a 
> database? I've always thought the filesystem was pretty much off limits 
> from the appserver.
>  
> thanks.
> .peter
>  
> 
> 
> 
> This transmission contains information solely for intended recipient and 
> may be privileged, confidential and/or otherwise protect from 
> disclosure. If you are not the intended recipient, please contact the 
> sender and delete all copies of this transmission. This message and/or 
> the materials contained herein are not an offer to sell, or a 
> solicitation of an offer to buy, any securities or other instruments. 
> The information has been obtained or derived from sources believed by us 
> to be reliable, but we do not represent that it is accurate or complete. 
> Any opinions or estimates contained in this information constitute our 
> judgment as of this date and are subject to change without notice. Any 
> information you share with us will be used in the operation of our 
> business, and we do not request and do not want any material, nonpublic 
> information. Absent an express prior written agreement, we are not 
> agreeing to treat any information confidentially and will use any and 
> all information and reserve the right to publish or disclose any 
> information you share with us.
> 


-- 

---------------------
David Ward
[EMAIL PROTECTED]
http://www.dotech.com



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



This transmission contains information solely for intended recipient and may
be privileged, confidential and/or otherwise protect from disclosure.  If
you are not the intended recipient, please contact the sender and delete all
copies of this transmission.  This message and/or the materials contained
herein are not an offer to sell, or a solicitation of an offer to buy, any
securities or other instruments.  The information has been obtained or
derived from sources believed by us to be reliable, but we do not represent
that it is accurate or complete.  Any opinions or estimates contained in
this information constitute our judgment as of this date and are subject to
change without notice.  Any information you share with us will be used in
the operation of our business, and we do not request and do not want any
material, nonpublic information. Absent an express prior written agreement,
we are not agreeing to treat any information confidentially and will use any
and all information and reserve the right to publish or disclose any
information you share with us.


-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to