By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,733 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

Java on iSeries: setBinaryStream problem

P: n/a
Hi,

I have got a problem inserting data of a file (both, binary and text) into
a blob column. It is created with "Data BLOB(2G)" in the sql statement (so
the name of the column is obviously 'Data'). I use a PreparedStatement
with the method setBinaryStream. And as far as i can remember it already
had worked until... hm, that's the question! The problem is now that I'm
able to insert files with a size of about 400k. I don't know the exact
size. I have tried it with a 530k-file and this does not work. What
happens is that the method hangs. It does not return anymore. But I'm
almost sure that this has already worked a while ago. But I can not find
out what has changed (in my opinion nothing has changed, so I'm suprised
about this).

The code:

FileInputStream fis = new FileInputStream(aFileObject);

BufferedInputStream bis = new BufferedInputStream(fis);
psNewDoc.setString(1, docID);
psNewDoc.setString(2, mime);
psNewDoc.setInt(3, seq);

psNewDoc.setBinaryStream(4, bis, (int) aFileObject.length());

psNewDoc.executeUpdate();

What could be wrong with this? Nothing?
The programm runs on a as400/V5R2 with the jt400 library. The db2 driver
is used, not the pure java version.

Thanks for any hint,
Robert
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

Hi. Nothing's wrong with the code. Get a thread dump to see what is hanging.
It soulds like the client library has a bug, or... when this happens, get
your DBA to tell you what the DBMS thinks is happening on that connection.
What happens if you try using a type-4 (all Java) jdbc driver?
Joe Weinstein at BEA

Robert Schneider wrote:
Hi,

I have got a problem inserting data of a file (both, binary and text)
into a blob column. It is created with "Data BLOB(2G)" in the sql
statement (so the name of the column is obviously 'Data'). I use a
PreparedStatement with the method setBinaryStream. And as far as i can
remember it already had worked until... hm, that's the question! The
problem is now that I'm able to insert files with a size of about 400k.
I don't know the exact size. I have tried it with a 530k-file and this
does not work. What happens is that the method hangs. It does not
return anymore. But I'm almost sure that this has already worked a
while ago. But I can not find out what has changed (in my opinion
nothing has changed, so I'm suprised about this).

The code:

FileInputStream fis = new FileInputStream(aFileObject);

BufferedInputStream bis = new BufferedInputStream(fis);
psNewDoc.setString(1, docID);
psNewDoc.setString(2, mime);
psNewDoc.setInt(3, seq);

psNewDoc.setBinaryStream(4, bis, (int) aFileObject.length());

psNewDoc.executeUpdate();

What could be wrong with this? Nothing?
The programm runs on a as400/V5R2 with the jt400 library. The db2
driver is used, not the pure java version.

Thanks for any hint,
Robert


Nov 12 '05 #2

P: n/a
Thank you for your answer.

Now I found out that the programm didn't use the native db2 driver. This
was a mistake by myself. So it has used the pure java driver. And now I
changed this and now it fortunately works!

But I'm still wondering why the pure java driver does not work. Do you
know why?

Robert


Am Tue, 12 Oct 2004 09:00:20 -0700 schrieb Joe Weinstein
<jo*******@bea.com>:

Hi. Nothing's wrong with the code. Get a thread dump to see what is
hanging.
It soulds like the client library has a bug, or... when this happens, get
your DBA to tell you what the DBMS thinks is happening on that
connection.
What happens if you try using a type-4 (all Java) jdbc driver?
Joe Weinstein at BEA

Robert Schneider wrote:
Hi,
I have got a problem inserting data of a file (both, binary and text)
into a blob column. It is created with "Data BLOB(2G)" in the sql
statement (so the name of the column is obviously 'Data'). I use a
PreparedStatement with the method setBinaryStream. And as far as i can
remember it already had worked until... hm, that's the question! The
problem is now that I'm able to insert files with a size of about
400k. I don't know the exact size. I have tried it with a 530k-file
and this does not work. What happens is that the method hangs. It does
not return anymore. But I'm almost sure that this has already worked a
while ago. But I can not find out what has changed (in my opinion
nothing has changed, so I'm suprised about this).
The code:
FileInputStream fis = new FileInputStream(aFileObject);
BufferedInputStream bis = new BufferedInputStream(fis);
psNewDoc.setString(1, docID);
psNewDoc.setString(2, mime);
psNewDoc.setInt(3, seq);
psNewDoc.setBinaryStream(4, bis, (int) aFileObject.length());
psNewDoc.executeUpdate();
What could be wrong with this? Nothing?
The programm runs on a as400/V5R2 with the jt400 library. The db2
driver is used, not the pure java version.
Thanks for any hint,
Robert


Nov 12 '05 #3

P: n/a
Hi,

seems a driver bug to me; try the newest (jtopen) (or another) version of
the driver

Dieter

Robert Schneider wrote:
Thank you for your answer.

Now I found out that the programm didn't use the native db2 driver. This
was a mistake by myself. So it has used the pure java driver. And now I
changed this and now it fortunately works!

But I'm still wondering why the pure java driver does not work. Do you
know why?

Robert


Am Tue, 12 Oct 2004 09:00:20 -0700 schrieb Joe Weinstein
<jo*******@bea.com>:

Hi. Nothing's wrong with the code. Get a thread dump to see what is
hanging.
It soulds like the client library has a bug, or... when this happens, get
your DBA to tell you what the DBMS thinks is happening on that
connection.
What happens if you try using a type-4 (all Java) jdbc driver?
Joe Weinstein at BEA

Robert Schneider wrote:
Hi,
I have got a problem inserting data of a file (both, binary and text)
into a blob column. It is created with "Data BLOB(2G)" in the sql
statement (so the name of the column is obviously 'Data'). I use a
PreparedStatement with the method setBinaryStream. And as far as i can
remember it already had worked until... hm, that's the question! The
problem is now that I'm able to insert files with a size of about
400k. I don't know the exact size. I have tried it with a 530k-file
and this does not work. What happens is that the method hangs. It does
not return anymore. But I'm almost sure that this has already worked a
while ago. But I can not find out what has changed (in my opinion
nothing has changed, so I'm suprised about this).
The code:
FileInputStream fis = new FileInputStream(aFileObject);
BufferedInputStream bis = new BufferedInputStream(fis);
psNewDoc.setString(1, docID);
psNewDoc.setString(2, mime);
psNewDoc.setInt(3, seq);
psNewDoc.setBinaryStream(4, bis, (int) aFileObject.length());
psNewDoc.executeUpdate();
What could be wrong with this? Nothing?
The programm runs on a as400/V5R2 with the jt400 library. The db2
driver is used, not the pure java version.
Thanks for any hint,
Robert


Nov 12 '05 #4

P: n/a


Robert Schneider wrote:
Thank you for your answer.

Now I found out that the programm didn't use the native db2 driver.
This was a mistake by myself. So it has used the pure java driver. And
now I changed this and now it fortunately works!

But I'm still wondering why the pure java driver does not work. Do you
know why?

Robert
If you do what I suggested we will know more. Get it to hang, then get a thread dump
so we can see what the client is waiting on. Then check the DBMS to see what it
thinks is happening on the connection. This sounds like a bug in the all-java
driver.

Joe Weinstein at BEA




Am Tue, 12 Oct 2004 09:00:20 -0700 schrieb Joe Weinstein
<jo*******@bea.com>:

Hi. Nothing's wrong with the code. Get a thread dump to see what is
hanging.
It soulds like the client library has a bug, or... when this happens, get
your DBA to tell you what the DBMS thinks is happening on that
connection.
What happens if you try using a type-4 (all Java) jdbc driver?
Joe Weinstein at BEA

Robert Schneider wrote:
Hi,
I have got a problem inserting data of a file (both, binary and
text) into a blob column. It is created with "Data BLOB(2G)" in the
sql statement (so the name of the column is obviously 'Data'). I
use a PreparedStatement with the method setBinaryStream. And as far
as i can remember it already had worked until... hm, that's the
question! The problem is now that I'm able to insert files with a
size of about 400k. I don't know the exact size. I have tried it
with a 530k-file and this does not work. What happens is that the
method hangs. It does not return anymore. But I'm almost sure that
this has already worked a while ago. But I can not find out what
has changed (in my opinion nothing has changed, so I'm suprised
about this).
The code:
FileInputStream fis = new FileInputStream(aFileObject);
BufferedInputStream bis = new BufferedInputStream(fis);
psNewDoc.setString(1, docID);
psNewDoc.setString(2, mime);
psNewDoc.setInt(3, seq);
psNewDoc.setBinaryStream(4, bis, (int) aFileObject.length());
psNewDoc.executeUpdate();
What could be wrong with this? Nothing?
The programm runs on a as400/V5R2 with the jt400 library. The db2
driver is used, not the pure java version.
Thanks for any hint,
Robert



Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.