Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Support for DB2 on iSeries?
Support for DB2 on iSeries? [message #379888] Sun, 24 August 2008 00:00 Go to next message
Bill Blalock is currently offline Bill BlalockFriend
Messages: 119
Registered: July 2009
Location: Alabama
Senior Member
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.sqlExce ption(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(AS400J DBCStatement.java:1557)
at
com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:193)
at
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS 400JDBCConnection.java:2025)
at
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS 400JDBCConnection.java:1824)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.prepareStatement(DatabaseAccessor.java:1340)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseCall .prepareStatement(DatabaseCall.java:648)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.basicExecuteCall(DatabaseAccessor.java:550)
... 43 more

..
Re: Support for DB2 on iSeries? [message #379889 is a reply to message #379888] Sun, 24 August 2008 11:39 Go to previous messageGo to next message
Doug Clarke is currently offline Doug ClarkeFriend
Messages: 155
Registered: July 2009
Senior Member
Bill,

Thanks for the feedback. EclipseLink is intended to be an extensible
framework where one of the extension points is the ability to provide your
own database platform. You should not need to checkout all of EclipseLink
to use a custom platform class from your own application source.

If your platform is working and you want to contribute it back to the
EclipseLink project please open an enhancement request and attach you
platform class.

Doug
Re: Support for DB2 on iSeries? [message #379894 is a reply to message #379889] Sun, 24 August 2008 20:14 Go to previous messageGo to next message
Bill Blalock is currently offline Bill BlalockFriend
Messages: 119
Registered: July 2009
Location: Alabama
Senior Member
Doug:

1. Should my subclass be named DB2Platform? I ask because I see some
specific behavior in the DatabaseLogin class for DB2. Would DatabaseLogin
and other parts of Eclipslink treat my platform subclass as a DB2 platform
if it was called something else (say DB2UDBiSeriesPlatform)?

2. I am using the jtOpen 6.x JDBC drivers.
DatabaseLogin.isDB2JDBCDriver() returns false. Is this going to cause
problems as in Eclipselink not recognizing this an iSeries / AS400
database as a flavor of DB2?

Thanks
Bill Blalock
Re: Support for DB2 on iSeries? [message #379895 is a reply to message #379894] Mon, 25 August 2008 14:18 Go to previous messageGo to next message
Doug Clarke is currently offline Doug ClarkeFriend
Messages: 155
Registered: July 2009
Senior Member
Bill,

Your platform class can be named anything you want. Subclassing
DB2Platform is key to gain all of the other functionality. The
isDB2JDBCDriver() method on DatabaseLogin is a convenience method for
external users and does not appear to be used anywhere internally (at
least not in DB2Platform or DB2MainframePlatform).

Doug
Re: Support for DB2 on iSeries? -- can't find my DpP subclass [message #380515 is a reply to message #379889] Tue, 26 August 2008 20:31 Go to previous message
Bill Blalock is currently offline Bill BlalockFriend
Messages: 119
Registered: July 2009
Location: Alabama
Senior Member
Doug:

Eclipselink JPA can't find my DatabasePlatform subclass.

I have been experimenting with a headless RCP based on the example
provided in the wiki.

Eclipselink API/workbench could find my subclass.
Eclipselink JPA also could find my subclass when it was in a Java Project
that was exported as a jar file and included in the runtime classpath of
the headless RCP.

I changed from using a Java Project for my domain objects and DbP subclass
to using a plug-in. I made the change to avoid having to export the Java
Project to a jar and copy the jar into the Headless RCP each time a change
was made.

Now Eclipselink JPA can't find my DbP subclass.

This is a snippett from the persistence.xml file which worked when my DbP
subclass and domain objects were in a jar.

<jar-file>dataobjects.jar</jar-file>
<properties>
<property name="eclipselink.jdbc.driver"
value="com.ibm.as400.access.AS400JDBCDriver"/>
<property name="eclipselink.jdbc.url" value="jdbc:as400://tusmn1a4;date
format=iso;naming=sql;libraries=*LIBL SYSMONDB$"/>
..
..
<property name="eclipselink.jdbc.native-sql" value="true"/>
<property name="eclipselink.target-database"
value="eclipselink.DB2UDBiSeriesPlatform"/>
</properties>

Now dataobjects is a plugin. I removed the <jar-file>. Eclipeslink JPA
can't find my DbP subclass when I execute the RCP. These are the errors:

javax.persistence.PersistenceException: Exception [EclipseLink-7042]
(Eclipse Persistence Services - 1.0 (Build 1.0 - 20080707)):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: Database platform class
[eclipselink.DB2UDBiSeriesPlatform] not found.
Internal Exception: Exception [EclipseLink-3007] (Eclipse Persistence
Services - 1.0 (Build 1.0 - 20080707)):
org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [eclipselink.DB2UDBiSeriesPlatform], of
class [class java.lang.String], could not be converted to [class
java.lang.Class]. Please ensure that the class
[eclipselink.DB2UDBiSeriesPlatform] is on the CLASSPATH. You may need to
use alternate API passing in the appropriate class loader as required, or
setting it on the default ConversionManager
Internal Exception: java.lang.ClassNotFoundException:
eclipselink.DB2UDBiSeriesPlatform

I've tried everything I can think of to get this to work.

The error messages says:

You may need to use alternate API passing in the appropriate class loader
as required, or setting it on the default ConversionManager

How do you do that? I can't find any meaningful reference to doing this
in the Eclipsewiki.

Thanks
Bill Blalock
Previous Topic:Database generated primary key - problems with insert
Next Topic:custom SessionCustomizer cannot cast to org...config.SessionCustomizer
Goto Forum:
  


Current Time: Tue Mar 19 09:59:28 GMT 2024

Powered by FUDForum. Page generated in 0.01669 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top