com.ibm.as400.access.AS400JDBCDriver
COM.ibm.db2.jdbc.app.DB2Driver
com.ibm.db2.jcc.DB2Driver (not sure about this one)
I can't seem to anything to load by default without some SQLException
being thrown, mostly java.lang.UnsatisfiedLinkError. I don't use Java
in my day-to-day activities but I sure thought it would be easier than
this. I only need to make a connection to the DB on the same machine
that the program is running on, which in this case is the 400 itself.
My searches say that com.ibm.db2.jcc.app.DB2Driver is the 'native'
driver to use but I can't get it to load. I'm finding a name
discrepancy between com.ibm.db2.jcc.DB2Driver and
com.ibm.db2.jcc.app.DB2Driver, although the one without the 'app' is
one I can at least find on the system.
We have the following Java-related options:
5761JC1 *BASE 5050 IBM Toolbox for Java
5761JC1 *BASE 2924 IBM Toolbox for Java
5761JV1 *BASE 5050 IBM Developer Kit for Java
5761JV1 *BASE 2924 IBM Developer Kit for Java
5761JV1 6 5106 Java Developer Kit 1.4
5761JV1 7 5107 Java Developer Kit 5.0
5761JV1 8 5108 J2SE 5.0 32 bit
5761JV1 10 5110 Java SE Development Kit 6
5761JV1 11 5111 Java SE 6 32 bit
I'm getting closer - maybe. Found through another post to use /QIBM/
ProdData/Java400/ext/db2_classes.jar. I had to change the name of the
driver in the code from com.ibm.db2.jcc.app.DB2Driver (which was wrong
anyway, see the "jcc" part) to com.ibm.db2.jdbc.app.DB2Driver. Now
I'm getting this:
com.ibm.db2.jdbc.app.DB2JDBCDataException: CCSID value is not
valid.
at java.lang.Throwable.<init>(Throwable.java:
195)
at java.lang.Exception.<init>(Exception.java:
41)
at java.sql.SQLException.<init>(SQLException.java:
40)
at com.ibm.db2.jdbc.app.DB2JDBCDataException.<init>
(DB2JDBCDataException.java:45)
at com.ibm.db2.jdbc.app.DB2SQLException.createException
(DB2SQLException.java:94)
at com.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:
754)
at com.ibm.as400.system.nativ.JavaLangClassObject.newInstance0
(JavaLangClassObject.java:164)
at java.lang.Class.newInstance(Class.java:
285)
at as400test.DBTest(as400test.java:
134)
at as400test.main(as400test.java:
113)
Just a SWAG: That the CCSID() being established for the User
Profile is *HEX [aka 65535] which requests not to translate the
data. Requesting no character data translation is problematic for
EBCDIC to ASCII and vice versa. Perhaps by signing on interactively
to the server, signed on as the user making the connection and then
issuing the command CHGPRF CCSID(37) or as any user CHGUSRPRF
TheUser CCSID(37) [or any EBCDIC CCSID value appropriate to the
language used by that user profile; optionally, first issuing
DSPUSRPRF, to review the current CCSID setting] will effect a valid
CCSID value being established for a new connection.
If not that, then a small possibility that file(s) being accessed
have Character data types with the CCSID(65535). However for that,
I would expect the JDBC to just honor the request to treat the data
as binary character string. That is, the results for the character
data would not be readable as ASCII, but the request should function
without any CCSID error.
http://www.google.com/#hl=en&q="+CCSID+value+is+not+valid"+jdbc
FWiW the above search returns the following, and more:
http://www.ibm.com/developerworks/forums/thread.jspa?messageID=13721939&tstart=0
http://www-912.ibm.com/s_dir/slkbase.NSF/0/9ea41ee0c6099d1e86256caa006e4b59?OpenDocument
http://article.gmane.org/gmane.comp.lang.as400.java/10019
http://archive.midrange.com/midrange-l/200802/msg01136.html
http://archive.midrange.com/web400/200702/msg00096.html
Regards, Chuck
Dieter
--
Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherA�ejoAlcoolInside
Spaccamaroni andate a cagare/Spammers not welcome/Spammers v�o � merda
Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'
The relative beauty of the code notwithstanding, came from a vendor.
Nevertheless, it should have worked.
Ok. Some of the links that were posted (Chuck) I had found through
Google. I just needed some time to make sense of what the whole CCSID
issue was about. After I changed the name of the driver jar from
db2jcc.jar to db2_classes.jar and the driver classname from
com.ibm.db2.jcc.DB2Driver to com.ibm.db2.jdbc.app.DB2Driver I had our
sysadmin assign my profile CCSID of 37 (funny he didn't know what 37
was...), ran the sample program again and success.
So thanks to everyone for your help and input. I get to touch Java
once every 5 years of so.
Back to my C++ duties I guess.....
Kelly Beard
in java its state of the art to have all driver dependent information
outside the java class and the code runs if the environment is set up
properly and you never would have to look inside the code
Dieter