[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.rt.eclipselink] Support for DB2 on iSeries?
|
For the last two weeks I have been learning about Eclipselink using an IBM
System i (DB2 Universal Database for iSeries). I used the DB2Platform
class with the jtOpen 6.1 JDBC 4.0 driver.
This worked until I got to adding rows. See end of post for exception.
After studying the org.eclipse.persistence.platform.database.DB2Platform
class I saw a couple of problems for DB400.
1. The system catalog is fully specified in hard coded queries. However
SYSIBM.SYSTABLES does work on DB2 for iSeries AS400 (at least I think that
is the problem), it should be
QSYS2.SYSTABLES for iSeries
and perhaps SYSCAT.SYSTABLES for Linux/UNIX and maybe Windows
SYSIBM is a schema on the iSeries but it does not contain SYSTABLES, only
QSYS2 contains SYSTABLES.
2. SYSTABLES of DB2 for iSeries doesn't have the column TBCREATOR,
instead it has a column CREATOR and column SYSTABLE to indicate whether
the row represents a system table (Y!N).
In the method getNativeTableInfo()
String query = "SELECT * FROM SYSIBM.SYSTABLES WHERE TBCREATOR NOT IN
('SYS', 'SYSTEM')";
should be
String query = "SELECT * FROM QSYS2.SYSTABLES WHERE SYSTABLE = 'N'";
and TBCREATOR changed to CREATOR in these lines
if (creator != null) {
if (creator.indexOf('%') != -1) {
query = query + " AND TBCREATOR LIKE " + creator;
} else {
query = query + " AND TBCREATOR = " + creator;
}
}
I want to fix this and offer the fix to the Eclipselink project.
I subclassed DB2Platform and overrode the methods:
getNativeTableInfo()
getTimestampQuery()
I referenced the subclass in place of DB2Platform.class in sessions.xml.
So far this is working and has fixed the problems.
My questions:
1. If you are familiar with DB2 what do you think???
Has anyone run into this before?
2. What should be checked out of subversion for the current release now
being distributed?
This will be the first time I have check out an Eclipse project to
recompile. Please help me out here.
Any suggestions "or references to documentation" on how to build
eclipselink.jar after I check out the proper "module" (new to subversion,
thinking in CVS terms)
Thank you
Bill Blalock
====================
Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0 (Build
1.0 - 20080707)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: [SQL0204] SYSTABLES in SYSIBM
type *FILE not found.
Error Code: -204
Call: SELECT DISTINCT CURRENT TIMESTAMP FROM SYSIBM.SYSTABLES
Query: ValueReadQuery()
at
org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:322)
..
Caused by: java.sql.SQLException: [SQL0204] SYSTABLES in SYSIBM type *FILE
not found.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:621)
at
com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1557)
at
com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:193)
at
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:2025)
at
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1824)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1340)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStatement(DatabaseCall.java:648)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:550)
... 43 more
.