Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Error in loading big file

9 views
Skip to first unread message

Joe Weinstein

unread,
Feb 11, 2005, 10:47:55 PM2/11/05
to
Fred Wang wrote:

> Hi All,
> I have an application on WL8.1 with sp3, the database is SQL Server 2000. I have code below to load local file into database. The data type in database is image.
>
> PreparedStatement pStatement = null;
> InputStreammyStream myStream = new InputStream();
> myStream.setEmbeddedStream( is );
> pStatement.setBinaryStream( 1, myStream, -1 );
> pStatement.executeUpdate();
> pStatement.close();
> pStatement = null;
>
> is is InputStream from a local file and the sql statement is
> insert into file_content(content) values(?)
>
> This workes fine for the files with size less than 150M, but for those big files (>150M), it doesn't work and I got error message as below:
>
> <Feb 11, 2005 12:00:41 PM PST> <Notice> <EJB> <BEA-010014> <Error occurred while attempting to rollback transaction: javax.transaction.SystemException: Heuristic hazard: (weblogic.jdbc.wrapper.JTSXAResourceImpl, HeuristicHazard, (javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver]Object has been closed.))
> javax.transaction.SystemException: Heuristic hazard: (weblogic.jdbc.wrapper.JTSXAResourceImpl, HeuristicHazard, (javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver]Object has been closed.))
> at weblogic.transaction.internal.ServerTransactionImpl.internalRollback(ServerTransactionImpl.java:396)
> at weblogic.transaction.internal.ServerTransactionImpl.rollback(ServerTransactionImpl.java:362)
>
> Any body can help? Thanks in advance.

I already answered this as to the cause, in the ms newsgroups... It's the DBMS choking so
bad on the size of your image file that it actually kills the connection. Note that the DBMS
has to save the whole image to log as well as to the DBMS table. The fundamental response is
to get DBA help to configure the DBMS to be able to do what you want. If you want and can,
you could split your image column into multiple image columns, and split your data into
100meg chunks, and then enter an empty row and then update it column by column, and then
concatenate the data again in the cleint when you get it out, etc, but much better to post
to the MS server newsgroups for ideas.
Joe

Fred Wang

unread,
Feb 11, 2005, 5:51:20 PM2/11/05
to

Slava Imeshev

unread,
Feb 12, 2005, 12:18:46 AM2/12/05
to
"Fred Wang" <noad...@noaddress.given> wrote in message news:28197394.1108179415122.JavaMail.root@jserv5...

> Hi All,
> I have an application on WL8.1 with sp3, the database is SQL Server 2000. I have code below to load local file into database. The
data type in database is image.
>

Generally it is a bad idea to store in a relational database
large non-transactional data like images...

You may consider storing images in the file systems and storing
only file paths in the database. That is going to be much faster
and would scale better.

Regards,

Slava Imeshev


Fred Wang

unread,
Feb 14, 2005, 1:21:54 AM2/14/05
to
Thank you, Joe. Yes, I agree. Maybe it's the way to split the image into chunks. I've seen lots samples but all are on Oracle. No you have any sample code on SQL Server or do you think I can follow the Oracle ones? Thanks

Joe Weinstein

unread,
Feb 14, 2005, 2:18:58 PM2/14/05
to

Fred Wang wrote:

> Thank you, Joe. Yes, I agree. Maybe it's the way to split the
> image into chunks. I've seen lots samples but all are on Oracle.

> Now you have any sample code on SQL Server or do you think I


> can follow the Oracle ones? Thanks

I have no code for that. I haven't sen Oracle's. Splitting up
the image file is not DBMS-dependent. If those examples use
standard JDBC, then they should work everywhere. Good luck.
Joe

0 new messages