473,484 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Java on iSeries: setBinaryStream problem

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
4 4657

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
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
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


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7779
by: Thad Rizzi | last post by:
My webserver is an iSeries and I want to run some PHP scripts on it using SQL to access data on the iSeries. Does anyone have any exapmles or resources on the most effective way to do this? I...
0
1304
by: Pete | last post by:
Hi, I'm on a site where a third party application has been put on WebSphere 4.0.5 on an iSeries 820/V5R2. We have had horrendous performance / stability problems even with 10 users and even IBM...
1
14880
by: Yanik Reid | last post by:
When I run the following vb.net code, I'm not able to acces the my database AMFLIB. I use to be able to access AMFLIB with the old ODBC driver from IBM iSeries Access but now I want to use the...
17
7132
by: Sulu's Beard | last post by:
Hey gang, I'm evaluating the CA ERWin product for an upcoming data warehousing project. I'm most excited about the reverse engineering aspect of this system. I've sucessfully tested it on a...
0
1825
by: Twan Kennis | last post by:
Hello! I do have the following problem: I've developed a Windows application which communicates with a DB2-database on the iSeries platform using an ODBC-connection string. This...
3
4040
by: Laurence | last post by:
Hi there, Does somebody know the efficent way to connect DB2/400? Through iSeries Access ODBC/OLEDB driver or DB2 Connect? Which will more fast and efficent? In addition, does DB2 Connect use...
2
9414
by: Charles Wilt | last post by:
I have a IBM iSeries (aka AS-400) running v5r3 of OS/400 that I access via a linked server from SQL Server 2000. The following select works fine: select * from...
3
2451
by: Jeff Allan | last post by:
Hello, Does anyone out there have experience with connectivity to DB2 hosted on an iSeries? I have successfully written a VB.NET 2005 WEB application to do this but I am having a morning...
6
4579
by: Al G | last post by:
Can someone tell me what I need to get connected to our AS400? I am trying to write an app in VS2005(Data source, Gridview) that requires data from files on our AS400. I've downloaded DB2, and...
0
6954
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7106
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7226
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5407
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4848
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3042
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1362
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
592
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.