× 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 changing the line
source.setLibraries("DMSIDEV");
from JAMES to DMSIDEV when you move to production?

If not, you're picking up the file from DMSIDEV when you think you're running from test.

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.

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

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




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.