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



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

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.