473,583 Members | 3,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

iSeries: JDBC problem v5r3


I have a problem migrating an application from v5r2 to v5r3. The
problem is with the prepared statements.

To see what the problem is, i extracted a small piece of code and
debugged the application while running it on my local window machine
(IBM WSAD) but still connecting to the AS400.

For the local debugging I use "com.ibm.as400. access.AS400JDB CDriver"
but on the server it is of course "com.ibm.db2.jd bc.app.DB2Drive r".

When I use our old jdbc driver jar (an older toolbox driver - info:
JDBC driver major version = 3). It is ok.
When I use the the toolbox driver from the new server (Toolbox for Java
- Open Source Software, JTOpen 4.7, codebase 5722-JC1 V5R3M0.7) I have
a big problem with the prepared statements (this is the first problem I
have noticed, maybe there are still other problems, but I would like to
see this problem solved first).

I have a preparedstateme nt that is called 3 times (code fragment
follows at the end). There are 6 parameters in the statement. 5 of
which are always the same and one that is changed every time.

This is the output of the old driver - you see it finds one value for
each time the statement is executed:
ModuleType: S
RunCond: 2
DownSP: 1

When I run the same program with the newer toolbox driver in the
classpath, it sometimes does not find a result for the select. Output:
ModuleType: no value
RunCond: 2
DownSP: 1

I tried it once again and the the result was:
ModuleType: no value
RunCond: 2
DownSP: no value

You see it is not always the same that returns no result.

This is really puzzeling me. I cannot begin to wonder where the problem
lies. Maybe there are some (default) JDBC parameters that have been
changed??? Maybe something changed from v5r2 to v5r3 (I already looked
at a couple of documents on the web but nothing relevant to my

If someone has any idea, please let me know. I am going nuts :)

----------- code start ------------
Class.forName(" com.ibm.as400.a ccess.AS400JDBC Driver").newIns tance();

String AS400_v5r3_SQL = "SELECT poid, module, editable, oid, server,
created, datatype, effectiveto, parameter, value, upoid, actorgroup,
effectivefrom FROM REF.parameterva lue_data WHERE module = ? AND
effectiveto = ? AND actorgroup = ? AND parameter = (SELECT poid FROM
REF.parameter_d ata WHERE parameterid = ? AND effectiveto = ?) AND
server = ?";

Timestamp FAR_DISTANT_FUT URE = new Timestamp((new
GregorianCalend ar(2999, 11, 31, 23, 59, 59)).getTime(). getTime());
Integer AS400_v5r3_SERV ERPOID = new Integer(5);
Integer int1 = new Integer(17);
Integer int2 = new Integer(18);

Vector v = new Vector();
v.add("ModuleTy pe");
v.add("RunCond" );
v.add("DownSP") ;

PreparedStateme nt statement = (PreparedStatem ent)
connection.prep areStatement(AS 400_v5r3_SQL);

for (Iterator iter = v.iterator(); iter.hasNext(); ) {

String element = (String) iter.next();

statement.setOb ject(1, int1);
statement.setOb ject(2, FAR_DISTANT_FUT URE);
statement.setOb ject(3, int2);
statement.setOb ject(4, element);
statement.setOb ject(5, FAR_DISTANT_FUT URE);
statement.setOb ject(6, AS400_v5r3_SERV ERPOID);

ResultSet rs = (ResultSet) statement.execu teQuery();

if (rs.next()) {
System.err.prin tln(element + ": " + rs.getObject("v alue"));
} else {
System.err.prin tln(element + ": no value");

------------- code end ---------------

Mar 23 '06 #1
1 2687
to**********@gm ail.com wrote:
This is really puzzeling me. I cannot begin to wonder where the problem

I have no real idea because I've not so much experience on AS400 to give
a qualified statement.

But the usual problems with DB2 and JDBC (especially PreparedStateme nts)
is a version mismatch between DB2JAVA.ZIP used on the client and the DB2
version used.

So you may copy the db2java.zip file from the AS400 to your workstation
and use this zip file for your projects.

You have to check your classpath, maybe a different (wrong) db2java.zip
is found first. Debugging classpath is sometimes strange to horrible so
take care!

Mar 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Iain Tricker | last post by:
I'm running iSeries UDB V5R3. DROP statements are still generating level 30 script errors if the object being dropped doesn't exist. I thought these had been fixed in V5R3 to only generate level 20 errors, is there a PTF to enable this change? The scripts are running ===> RUNSQLSTM(....) ERRLVL(20) Thanks, Iain Tricker
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...
by: Ben.Combrink | last post by:
Hi We're using an iSeries running v5r3. I am trying to add a generated column to a table, using the statement below. The card_status column is a bitset. ALTER TABLE cards ADD COLUMN cpstatus8 INT GENERATED ALWAYS AS (card_status & 8);
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?
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
by: roberto | last post by:
Hello, I'm trying to retrieve some records in my web application using a jdbc Statement like this: statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); resultSet = statement.executeQuery(...); with DB2 v8.2 EE that has a connection to an iSeries v5.3 and JBoss as application server.
by: chmmr | last post by:
Hello, I would like to ask if there are any differences between DB2 in these versions (e.g. support of triggers, Java stored procedures and such). Also, does anyone know from which DB2 AS/400 version is Java officially supported? Thank you
by: maksr | last post by:
Is this a bug in Db2 on iSeries V5 R3? The following query should work: CREATE TABLE qtemp.t03 AS ( SELECT 1 AS foofoo_s , CASE WHEN 1=1 THEN 1 ELSE 2 END AS foofo FROM sysibm.sysdummy1 ) WITH data ;
by: --CELKO-- | last post by:
We just got a "SQL Statement too long or complex" error on the ISERIES. James was able to get a compile after replacing some full table names with (much shorter) correlation names, etc. I have not see his query, but what are the statement size limits? I thought they would be so large that this should not happen in a practical situation.
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
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. ...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
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...
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...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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...

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.