× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Are you ending your job before trying again? A connection pool holds connections. If you are trying to connect to the same server again, as you are in databasePool.getConnection(), it will reuse the previous connection rather than establishing a new one. I'm not sure exactly where that's going to be kept, but probably in the JVM instance that belongs to the job. Try ending your job between tries (signoff and signon a green screen session).

Note that these classes from com.ibm.as400.access are seldom used directly as you have done here. They are usually used in the JNDI specification enclosed in an xml file that configures a web container like Tomcat or WAS. Then a connection to the data source is requested from JNDI. To make a change in the library list in that situation, we bring down the JVM containing the container and restart it.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of James Rich
Sent: Monday, October 28, 2013 3:10 PM
To: Midrange Systems Technical Discussion
Subject: RE: JDBC error

On Mon, 28 Oct 2013, Dan Kimmel wrote:

Are you changing the line
source.setLibraries("DMSIDEV");
from JAMES to DMSIDEV when you move to production?

Yes. Checked and double checked.

Remember that doing a RNMOBJ and MOVOBJ has sometimes unexpected
results
when logical files and/or indexes are involved. RNMOBJ like you've done
changes all the indexes to point to the new name. MOVOBJ likewise
changes the indexes that pointed to the file in the JAMES library to
point to the file in the DMSIDEV library.

There are no logical files or indexes on this file.

You didn't say how you copied contents from DMSIDEV/COCTLP into
JAMES/COCTLP. Somewhere along the line, not all the contents were
copied.

CPYF FROMFILE(DMSIDEV/COCTLP) TOFILE(JAMES/COCTLP)

All of the contents were copied, verified with query and DSPFD. There is
something unusual happening when *any* file named COCTLP is placed into
library DMSIDEV. Whether I move the file, create it new from source, or
copy it from another location the second row of results contains invalid
data *even though the data is correct when queried or viewed with
DSPPFM*.


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of James Rich
Sent: Friday, October 25, 2013 5:58 PM
To: midrange-l
Subject: JDBC error

Hi everyone,

I've run across a strange error that I can't explain. I'm using JDBC to
access a file. When I access the file in the development library it works
fine, but if I do a MOVOBJ to the production library it stops working.
I'm on 7.1 and using JTOpen 7.10. The file is DDS defined. I compiled
the file into a testing library (JAMES) and then copied the production
data into it. Then I ran a little test java program (complete source
included below) which simply select all the rows in the file and prints
out one of the fields. When the file is in my testing library the results
are exactly what I expect: two results with values 1 and 2. Then I did:

RNMOBJ OBJ(DMSIDEV/COCTLP) OBJTYPE(*FILE) NEWOBJ(COCTLPX)

to rename the production file followed by:

MOVOBJ OBJ(JAMES/COCTLP) OBJTYPE(*FILE) TOLIB(DMSIDEV)

to move my file into production. But now that the file is in the
production library my test program fails. It still returns two rows, but
now every field in the second row is null. If I then move the file back
out of the production library and into the testing library it suddenly all
works again. I have double, triple, and quadruple checked library lists,
file objects, everything I can think of. Can anyone suggest what I have
missed?

Test program source:

package com.james.test;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.ibm.as400.access.AS400JDBCConnectionPool;
import com.ibm.as400.access.AS400JDBCConnectionPoolDataSource;

public class TestDMSI {

public static void main(final String[] args) throws Exception {
Connection connection = null;
PreparedStatement stmt = null;
ResultSet results = null;

try {
AS400JDBCConnectionPoolDataSource source =
new AS400JDBCConnectionPoolDataSource("db.host.com", "user",
"password");
source.setLibraries("DMSIDEV");
source.setPrompt(false);
//source.setServerTrace(8);
//source.setTrace(true);
AS400JDBCConnectionPool databasePool =
new
AS400JDBCConnectionPool(source);
databasePool.setMaxConnections(50);
connection = databasePool.getConnection();
stmt = connection.prepareStatement("SELECT *
FROM
COCTLP " +
"ORDER BY CCCOMPNUM");
results = stmt.executeQuery();

while (results.next()) {

System.out.println(results.getString("CCCOMPNUM"));
}
} finally {
safeClose(results);
safeClose(stmt);
safeClose(connection);
}
}

static void safeClose(final Connection closeable) {
if (closeable != null) try {
closeable.close();
} catch (Exception ignore) {
}
}

static void safeClose(final PreparedStatement closeable) {
if (closeable != null) try {
closeable.close();
} catch (Exception ignore) {
}
}

static void safeClose(final ResultSet closeable) {
if (closeable != null) try {
closeable.close();
} catch (Exception ignore) {
}
}
}


James Rich

if you want to understand why that is, there are many good books on
the design of operating systems. please pass them along to redmond
when you're done reading them :)
- Paul Davis on ardour-dev
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


James Rich

if you want to understand why that is, there are many good books on
the design of operating systems. please pass them along to redmond
when you're done reading them :)
- Paul Davis on ardour-dev
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.