473,804 Members | 3,757 Online
Bytes | Software Development & Data Engineering Community
+ 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 PreparedStateme nt
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);

BufferedInputSt ream bis = new BufferedInputSt ream(fis);
psNewDoc.setStr ing(1, docID);
psNewDoc.setStr ing(2, mime);
psNewDoc.setInt (3, seq);

psNewDoc.setBin aryStream(4, bis, (int) aFileObject.len gth());

psNewDoc.execut eUpdate();

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 4675

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
PreparedStateme nt 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);

BufferedInputSt ream bis = new BufferedInputSt ream(fis);
psNewDoc.setStr ing(1, docID);
psNewDoc.setStr ing(2, mime);
psNewDoc.setInt (3, seq);

psNewDoc.setBin aryStream(4, bis, (int) aFileObject.len gth());

psNewDoc.execut eUpdate();

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
PreparedStateme nt 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);
BufferedInputSt ream bis = new BufferedInputSt ream(fis);
psNewDoc.setStr ing(1, docID);
psNewDoc.setStr ing(2, mime);
psNewDoc.setInt (3, seq);
psNewDoc.setBin aryStream(4, bis, (int) aFileObject.len gth());
psNewDoc.execut eUpdate();
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
PreparedStateme nt 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);
BufferedInputSt ream bis = new BufferedInputSt ream(fis);
psNewDoc.setStr ing(1, docID);
psNewDoc.setStr ing(2, mime);
psNewDoc.setInt (3, seq);
psNewDoc.setBin aryStream(4, bis, (int) aFileObject.len gth());
psNewDoc.execut eUpdate();
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 PreparedStateme nt 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);
BufferedInputSt ream bis = new BufferedInputSt ream(fis);
psNewDoc.setStr ing(1, docID);
psNewDoc.setStr ing(2, mime);
psNewDoc.setInt (3, seq);
psNewDoc.setBin aryStream(4, bis, (int) aFileObject.len gth());
psNewDoc.execut eUpdate();
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
7807
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 am rather green with PHP. Any help would be appreciated, Thad Rizzi
0
1316
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 cannot seem to help. What I am after is opinions / a comparason someone has done (web link?) / docco about Java webservers performance looking at iSeries, Intel, Sparcs etc.
1
14950
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 new managed IBM.Data.DB2.iSeries data provider from iSeries Access V5R3. When I remove Database=AMFLIB from the connection string, I can connect but as soon as I try to specify a known database (like my good old AMFLIB) I get the following error:
17
7182
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 SQL Server 2000 system, however, when I run it against our iSeries DB2 system (on which our ERP exists), I encounter errors that essentially say that files are missing from our SYSCAT library. I'm not an iSeries expert, but I can say that the
0
1836
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 ODBC-connection-string refers to a system-connection configured within the iSeries Navigator based on the Windows username and password of the logged-on user.
3
4072
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 APPC over TCP/IP protocol? Or SNA protocol?
2
9483
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 prod400db.test.meldbf.InventoryHistory However, this insert statement fails: insert into prod400db.TEST.MELDBF.InventoryHistory
3
2463
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 connection problem. Every morning the iSeries will return an "invalid connection" error on the first attempt of the day. After that, all other connections work fine. I am thinking it's an iSeries issue but I can't find any data to back me up.
6
4606
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 installed it, but apparently I need an additional product, "DB Connect" to actually make a connection. "DB connect" says that it will only display tables with a type of "T", and as far as I know, we are using files, not tables on the 400. Can...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10571
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
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 we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.