By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,978 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,978 IT Pros & Developers. It's quick & easy.

JDBC Connection on AIX and DB2 7.2.4

P: n/a
hi there,

i have a problem connecting to a db2 database 7.2.4 on AIX using java
when running the javacode on AIX using jdk1.3.1.
The classpath is correctly set to java12/...

on windows the following code works fine for the same database:

DB2XADataSource db2 = new DB2XADataSource();
db2.setDatabaseName("MYDB");
db2.setPassword("test1");
db2.setUser("test1");
xaconnection = db2.getXAConnection();
connection = xaconnection.getConnection();

the database MYDB is configured in the client configuration assistant
on the windows machine

on the AIX machine xaconnection.getConnection() returns null
not even an exception is thrown
i cant figure out why that happens. I tried to set additional
properties
on the DB2XADataSource object, like port and servername, but I still
cant get a connection.

Does anybody know how to get the connection or
how to get more error or trace information.

Thank you.

Steffen
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
By default, db2 would use IPC communication when you try to build local
application.
catalog the database as tcpip data sources, then try again.

"Steffen" <gl*****@gmx.net> wrote in message
news:f7*************************@posting.google.co m...
hi there,

i have a problem connecting to a db2 database 7.2.4 on AIX using java
when running the javacode on AIX using jdk1.3.1.a
The classpath is correctly set to java12/...

on windows the following code works fine for the same database:

DB2XADataSource db2 = new DB2XADataSource();
db2.setDatabaseName("MYDB");
db2.setPassword("test1");
db2.setUser("test1");
xaconnection = db2.getXAConnection();
connection = xaconnection.getConnection();

the database MYDB is configured in the client configuration assistant
on the windows machine

on the AIX machine xaconnection.getConnection() returns null
not even an exception is thrown
i cant figure out why that happens. I tried to set additional
properties
on the DB2XADataSource object, like port and servername, but I still
cant get a connection.

Does anybody know how to get the connection or
how to get more error or trace information.

Thank you.

Steffen

Nov 12 '05 #2

P: n/a
What is the better way to connect to the database (icp i assume)?
ipc oder TCP

How can i catalog a Database as tcpip data source?
and how can i find out how the database is currently cataloged ?

Thanks for your first answer.
Steffen
"Fan Ruo Xin" <fa*****@sbcglobal.net> wrote in message news:<LG***************@newssvr32.news.prodigy.com >...
By default, db2 would use IPC communication when you try to build local
application.
catalog the database as tcpip data sources, then try again.

"Steffen" <gl*****@gmx.net> wrote in message
news:f7*************************@posting.google.co m...
hi there,

i have a problem connecting to a db2 database 7.2.4 on AIX using java
when running the javacode on AIX using jdk1.3.1.a
The classpath is correctly set to java12/...

on windows the following code works fine for the same database:

DB2XADataSource db2 = new DB2XADataSource();
db2.setDatabaseName("MYDB");
db2.setPassword("test1");
db2.setUser("test1");
xaconnection = db2.getXAConnection();
connection = xaconnection.getConnection();

the database MYDB is configured in the client configuration assistant
on the windows machine

on the AIX machine xaconnection.getConnection() returns null
not even an exception is thrown
i cant figure out why that happens. I tried to set additional
properties
on the DB2XADataSource object, like port and servername, but I still
cant get a connection.

Does anybody know how to get the connection or
how to get more error or trace information.

Thank you.

Steffen

Nov 12 '05 #3

P: n/a
Steffen wrote:
What is the better way to connect to the database (icp i assume)?
ipc oder TCP
IPC is faster but it requires that your client is on the same machine as
your server.
How can i catalog a Database as tcpip data source?
Have a look at the following DB2 commands:

CATALOG TCPIP NODE ...
CATALOG DATABASE ... AT NODE ...
and how can i find out how the database is currently cataloged ?


LIST DATABASE DIRECTORY

--> that tells you the node for each database and

LIST NODE DIRECTORY

--> that tells you more about each node, including the protocol used to talk
to that node

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #4

P: n/a
You can use the loopback technique to catalog the local instance and
database as a remote instance
and database.
1. Catalog the local instance as a remote node:
CATALOG TCPIP NODE node_name REMOTE hostname SERVER
port_number_or_service_name
2. Catalog the local database as a remote database:
CATALOG DB local_database_name AS alias_name_for_local_database AT NODE
node_name
HTH

"Knut Stolze" <st****@de.ibm.com> wrote in message
news:cc**********@fsuj29.rz.uni-jena.de...
Steffen wrote:
What is the better way to connect to the database (icp i assume)?
ipc oder TCP
IPC is faster but it requires that your client is on the same machine as
your server.
How can i catalog a Database as tcpip data source?


Have a look at the following DB2 commands:

CATALOG TCPIP NODE ...
CATALOG DATABASE ... AT NODE ...
and how can i find out how the database is currently cataloged ?


LIST DATABASE DIRECTORY

--> that tells you the node for each database and

LIST NODE DIRECTORY

--> that tells you more about each node, including the protocol used to

talk to that node

--
Knut Stolze
Information Integration
IBM Germany / University of Jena

Nov 12 '05 #5

P: n/a
Hi, thanks for your help so far

i am getting a connection now but:

I need to connect to 2 different databases on the same db2 instance.
However i can only get a connection to the first database. As soon
as i try to connect to the second database, (having the first
connection
still open) i get an exception.
I can connect to each of the databases separatly but not at the same
time
within one javaprogram.
The problem only occurs when i am locally on the aix machine where the
db2
instance resides. Running the program remotely from a windows machine
works
fine. Is it the IPC connction type the problem because it only works
for
one connection?

Thank you

Steffen

Exception:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0119E Unexpected
system failure. SQLSTATE=58004
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(SQLExceptionGenerator.java(Compiled
Code))
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_r eturn_code(SQLExceptionGenerator.java(Compiled
Code))
at COM.ibm.db2.jdbc.app.DB2Connection.connect(DB2Conn ection.java(Compiled
Code))
at COM.ibm.db2.jdbc.app.DB2Connection.<init>(DB2Conne ction.java:388)
at COM.ibm.db2.jdbc.app.DB2ReusableConnection.<init>( DB2ReusableConnection.java:69)
at COM.ibm.db2.jdbc.DB2PooledConnection.getConnection (DB2PooledConnection.java:188)
at COM.ibm.db2.jdbc.DB2XAConnection.<init>(DB2XAConne ction.java:98)
at COM.ibm.db2.jdbc.DB2XADataSource.getXAConnection(D B2XADataSource.java:101)
at COM.ibm.db2.jdbc.DB2XADataSource.getXAConnection(D B2XADataSource.java:68)
at de.bgnet.pada.ssp.testing.TestDB2Connection.main(T estDB2Connection.java:42)
javacode:
DB2XADataSource sourceAda = new DB2XADataSource();
sourceAda.setDatabaseName("ADABG22");
sourceAda.setPassword("***");
sourceAda.setUser("adatest");

DB2XADataSource sourceTass = new DB2XADataSource();
sourceTass.setDatabaseName("TASSDEV");
sourceTass.setPassword("***");
sourceTass.setUser("adatest");

XAConnection adaXAConnection = sourceAda.getXAConnection();
Connection connectionAda = adaXAConnection.getConnection();
System.out.println("connection ADA=" + connectionAda);

XAConnection xaTASSconnection = sourceTass.getXAConnection();
Connection connectionTass = xaTASSconnection.getConnection();
System.out.println("connection TASS=" + connectionTass);
gl*****@gmx.net (Steffen) wrote in message news:<f7*************************@posting.google.c om>...
hi there,

i have a problem connecting to a db2 database 7.2.4 on AIX using java
when running the javacode on AIX using jdk1.3.1.
The classpath is correctly set to java12/...

on windows the following code works fine for the same database:

DB2XADataSource db2 = new DB2XADataSource();
db2.setDatabaseName("MYDB");
db2.setPassword("test1");
db2.setUser("test1");
xaconnection = db2.getXAConnection();
connection = xaconnection.getConnection();

the database MYDB is configured in the client configuration assistant
on the windows machine

on the AIX machine xaconnection.getConnection() returns null
not even an exception is thrown
i cant figure out why that happens. I tried to set additional
properties
on the DB2XADataSource object, like port and servername, but I still
cant get a connection.

Does anybody know how to get the connection or
how to get more error or trace information.

Thank you.

Steffen

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.