473,394 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

iSeries: JDBC problem v5r3

Hello,

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.AS400JDBCDriver"
but on the server it is of course "com.ibm.db2.jdbc.app.DB2Driver".

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 preparedstatement 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
problem).

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

Tom
----------- code start ------------
....
Class.forName("com.ibm.as400.access.AS400JDBCDrive r").newInstance();

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

Timestamp FAR_DISTANT_FUTURE = new Timestamp((new
GregorianCalendar(2999, 11, 31, 23, 59, 59)).getTime().getTime());
Integer AS400_v5r3_SERVERPOID = new Integer(5);
Integer int1 = new Integer(17);
Integer int2 = new Integer(18);

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

PreparedStatement statement = (PreparedStatement)
connection.prepareStatement(AS400_v5r3_SQL);

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

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

statement.setObject(1, int1);
statement.setObject(2, FAR_DISTANT_FUTURE);
statement.setObject(3, int2);
statement.setObject(4, element);
statement.setObject(5, FAR_DISTANT_FUTURE);
statement.setObject(6, AS400_v5r3_SERVERPOID);

ResultSet rs = (ResultSet) statement.executeQuery();

if (rs.next()) {
System.err.println(element + ": " + rs.getObject("value"));
} else {
System.err.println(element + ": no value");
}
}
....

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

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


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 PreparedStatements)
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!

Bernd
Mar 24 '06 #2

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

Similar topics

0
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...
1
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...
1
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...
3
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
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...
2
by: roberto | last post by:
Hello, I'm trying to retrieve some records in my web application using a jdbc Statement like this: statement =...
2
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...
1
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 )...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.