Java Connection Failure on z/OS

Arthur Brack

Java Connection Failure on z/OS
Hello everybody,

I am trying to establish a connection over SQLJ to DB2 9.1 on z/OS.
For that I am using the IBM-JDBC Type 2 driver.

I establish the connection the following way:

Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection db2Conn = DriverManager.getConnection("jdbc:db2:DB9G");

But I get the following error:

com.ibm.db2.jcc.t2zos.cb: IBM/DB2 T2zos/3.4.77
T2zosConnection.flowConnect:execConnect:1361:DB2 engine SQL error,
SQLCODE = -20210, SQLSTATE = 560B8, error tokens =
at com.ibm.db2.jcc.t2zos.ab.a(ab.java:48)
at com.ibm.db2.jcc.t2zos.ab.a(ab.java:778)
at com.ibm.db2.jcc.t2zos.ab.a(ab.java:484)
at com.ibm.db2.jcc.t2zos.ab.a(ab.java:852)
at com.ibm.db2.jcc.t2zos.T2zosConnection.c(T2zosConnection.java:1143)
at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:780)
at com.ibm.db2.jcc.t2zos.T2zosConnection.<init>(T2zosConnection.java:591)
at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:272)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:226)
at java.sql.DriverManager.getConnection(DriverManager.java:562)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at DB2Handler.initConnection(DB2Handler.java:144)
at MainDB2.main(MainDB2.java:5)


In the DB2 Codes manual I could find the following description for the
SQLSTATE = 560B8:
"The SQL statement was precompiled at a level prior to Version 7, but
the current value of the ENCODING bind option or special register does
not represent the system EBCDIC CCSIDs"

But I dont execute any SQL-statements and I dont have any SQL-statements
in my code, I just try to connect to the database.


Does anyone know a solution for that problem?
May this be an installation problem of DB2 for Java on z/OS?

Thanks very much in advance!

Regards,
Arthur Brack

______________________________________________________________________

* IDUG 2009 Denver, CO, USA * May 11-15, 2009 * http://IDUG.ORG/lsNA *
______________________________________________________________________



The IDUG DB2-L Listserv is only part of your membership in IDUG. The DB2-L list archives, FAQ, and delivery preferences are at http://www.idug.org/lsidug under the Listserv tab. While at the site, you can also access the IDUG Online Learning Center, Tech Library and Code Place, see the latest IDUG conference information and much more. If you have not yet signed up for Basic Membership in IDUG, available at no cost, click on Member Services at http://www.idug.org/lsms

Roland Schiradin

Re: Java Connection Failure on z/OS
(in response to Arthur Brack)
I saw once but can't remember.
1. Does the SYSLH2* package exists on your DB2?
2. Create them using db2jdbcbind -url jdbc:db2://<ip-address or
DNS>:<port>/DB2F -user xxx -password yyyyy -action replace
3. Enough for your session storage available?
4. STEPLIB entry for SDSNLOAD, SDSNEXIT, SDSNLOD2?

Roland


>Hello everybody,
>
>I am trying to establish a connection over SQLJ to DB2 9.1 on z/OS.
>For that I am using the IBM-JDBC Type 2 driver.
>
>I establish the connection the following way:
>
>Class.forName("com.ibm.db2.jcc.DB2Driver");
>Connection db2Conn = DriverManager.getConnection("jdbc:db2:DB9G");
>
>But I get the following error:
>
>com.ibm.db2.jcc.t2zos.cb: IBM/DB2 T2zos/3.4.77
>T2zosConnection.flowConnect:execConnect:1361:DB2 engine SQL error,
>SQLCODE = -20210, SQLSTATE = 560B8, error tokens =
> at com.ibm.db2.jcc.t2zos.ab.a(ab.java:48)
> at com.ibm.db2.jcc.t2zos.ab.a(ab.java:778)
> at com.ibm.db2.jcc.t2zos.ab.a(ab.java:484)
> at com.ibm.db2.jcc.t2zos.ab.a(ab.java:852)
> at com.ibm.db2.jcc.t2zos.T2zosConnection.c(T2zosConnection.java:1143)
> at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:780)
> at com.ibm.db2.jcc.t2zos.T2zosConnection.<init>
(T2zosConnection.java:591)
> at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:272)
> at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:226)
> at java.sql.DriverManager.getConnection(DriverManager.java:562)
> at java.sql.DriverManager.getConnection(DriverManager.java:208)
> at DB2Handler.initConnection(DB2Handler.java:144)
> at MainDB2.main(MainDB2.java:5)
>
>
>In the DB2 Codes manual I could find the following description for the
>SQLSTATE = 560B8:
>"The SQL statement was precompiled at a level prior to Version 7, but
>the current value of the ENCODING bind option or special register does
>not represent the system EBCDIC CCSIDs"
>
>But I dont execute any SQL-statements and I dont have any SQL-statements
>in my code, I just try to connect to the database.
>
>
>Does anyone know a solution for that problem?
>May this be an installation problem of DB2 for Java on z/OS?
>
>Thanks very much in advance!
>
>Regards,
>Arthur Brack

______________________________________________________________________

* IDUG 2009 Denver, CO, USA * May 11-15, 2009 * http://IDUG.ORG/lsNA *
______________________________________________________________________



The IDUG DB2-L Listserv is only part of your membership in IDUG. The DB2-L list archives, FAQ, and delivery preferences are at http://www.idug.org/lsidug under the Listserv tab. While at the site, you can also access the IDUG Online Learning Center, Tech Library and Code Place, see the latest IDUG conference information and much more. If you have not yet signed up for Basic Membership in IDUG, available at no cost, click on Member Services at http://www.idug.org/lsms

Rob Crane, II

Re: Java Connection Failure on z/OS
(in response to Roland Schiradin)
Normally I would see several items in your connection string (IP or DNS
name of the DB2 you are going after, DRDA port for that DB2, the
location name or bsds ddf location alias). As an example...



jdbc:db2://my.dns.for.DB9G:446/DDF_DB9G



After the subsystem info, you would have the userid and pwd for the
connection. Does not appear your getConnection string has the DB2
properly delineated, nor the userid/pwd the connection is suppose to
use.



Take a look at this, simple example for loading the driver and creating
a context

.http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com
.ibm.db2.udb.doc/ad/tjvsjcon.htm



Do you know what version of the jcc driver you are using and how it is
configured from the box you are trying to generate a connection from?
Normally you would just have the db2jcc.jar and license file (hopefully
being pointed to and centrally managed, rather than each java developer
plucking their own version to use and imbed in the jar), but depending
on how these (db2jcc.jar and license file) have been loaded into your
class path you may be surprised at what version you are running with.
It is at least good to understand where you are getting the driver from
and its version. Issue the db2jcc -configuration command to find out.



java com.ibm.db2.jcc.DB2Jcc

[-version]

[-configuration]

[-help]



-version Prints driver name and version

-configuration Prints driver configuration information

-help Prints this usage information



C:\SQLLIB\java

11/08/2007 09:14 PM 2,096,050 db2jcc.jar

08/12/2005 08:31 PM 2,063 db2jcc_license_cisuz.jar





I don't recommend the usage of the JDBC type 2 driver. Any reason you
do not want to use the JCC driver? Actually what you have in your
example is the JCC driver not the JDBC type 2 driver. If you really
want that you would use...
Class.forName("com.ibm.db2.jdbc.app.DB2Driver");



-Rob



-----Original Message-----
From: DB2 Data Base Discussion List [mailto:[login to unmask email] On
Behalf Of Arthur Brack
Sent: Friday, November 28, 2008 4:22 AM
To: [login to unmask email]
Subject: [DB2-L] Java Connection Failure on z/OS



Hello everybody,



I am trying to establish a connection over SQLJ to DB2 9.1 on z/OS.

For that I am using the IBM-JDBC Type 2 driver.



I establish the connection the following way:



Class.forName("com.ibm.db2.jcc.DB2Driver");

Connection db2Conn = DriverManager.getConnection("jdbc:db2:DB9G");



But I get the following error:



com.ibm.db2.jcc.t2zos.cb: IBM/DB2 T2zos/3.4.77

T2zosConnection.flowConnect:execConnect:1361:DB2 engine SQL error,

SQLCODE = -20210, SQLSTATE = 560B8, error tokens =

at com.ibm.db2.jcc.t2zos.ab.a(ab.java:48)

at com.ibm.db2.jcc.t2zos.ab.a(ab.java:778)

at com.ibm.db2.jcc.t2zos.ab.a(ab.java:484)

at com.ibm.db2.jcc.t2zos.ab.a(ab.java:852)

at com.ibm.db2.jcc.t2zos.T2zosConnection.c(T2zosConnection.java:1143)

at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:780)

at
com.ibm.db2.jcc.t2zos.T2zosConnection.<init>(T2zosConnection.java:591)

at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:272)

at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:226)

at java.sql.DriverManager.getConnection(DriverManager.java:562)

at java.sql.DriverManager.getConnection(DriverManager.java:208)

at DB2Handler.initConnection(DB2Handler.java:144)

at MainDB2.main(MainDB2.java:5)





In the DB2 Codes manual I could find the following description for the

SQLSTATE = 560B8:

"The SQL statement was precompiled at a level prior to Version 7, but

the current value of the ENCODING bind option or special register does

not represent the system EBCDIC CCSIDs"



But I dont execute any SQL-statements and I dont have any SQL-statements


in my code, I just try to connect to the database.





Does anyone know a solution for that problem?

May this be an installation problem of DB2 for Java on z/OS?



Thanks very much in advance!



Regards,

Arthur Brack



______________________________________________________________________



* IDUG 2009 Denver, CO, USA * May 11-15, 2009 * http://IDUG.ORG/lsNA *

______________________________________________________________________







The IDUG DB2-L Listserv is only part of your membership in IDUG. The
DB2-L list archives, FAQ, and delivery preferences are at
http://www.idug.org/lsidug under the Listserv tab. While at the site,
you can also access the IDUG Online Learning Center, Tech Library and
Code Place, see the latest IDUG conference information and much more.
If you have not yet signed up for Basic Membership in IDUG, available at
no cost, click on Member Services at http://www.idug.org/lsms


______________________________________________________________________

* IDUG 2009 Denver, CO, USA * May 11-15, 2009 * http://IDUG.ORG/lsNA *
______________________________________________________________________



The IDUG DB2-L Listserv is only part of your membership in IDUG. The DB2-L list archives, FAQ, and delivery preferences are at http://www.idug.org/lsidug under the Listserv tab. While at the site, you can also access the IDUG Online Learning Center, Tech Library and Code Place, see the latest IDUG conference information and much more. If you have not yet signed up for Basic Membership in IDUG, available at no cost, click on Member Services at http://www.idug.org/lsms