470,595 Members | 1,615 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,595 developers. It's quick & easy.

Testing for a Connection

Hello All,

After searching google groups and the web, there seems to be no good answer
to this but I thought I would ask anyway.

Is there a way to programmatically test for a db2 connection, similar to
'db2 get connection status'?

I can not even seem to programmatically direct the output of that command to
a file. Any ideas?

Thanks.

-g
Oct 19 '06 #1
3 1409
Geoff wrote:
Hello All,

After searching google groups and the web, there seems to be no good
answer to this but I thought I would ask anyway.

Is there a way to programmatically test for a db2 connection, similar to
'db2 get connection status'?
You could issue a simple SQL query like:

VALUES (1)

to test if a connection exists.
I can not even seem to programmatically direct the output of that command
to a file. Any ideas?
I would simply use pipes - assuming that you have C code.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Oct 19 '06 #2
I like that except we have several type 2 connections running at the same
time. When a connect is issued multiple times, programmatically, eventually
the process has problems creating threads. There is plenty of memory left
and the error is, 'can not start thread'.

I was looking for some other way to test if a live db is there before
actually trying to connect.

-g
Oct 19 '06 #3
Geoff wrote:
I was looking for some other way to test if a live db is there before
actually trying to connect.
Unless you explicitly activate the database using the ACTIVATE DATABASE
command, the DB is not active if no connection (from any client) exists.
Hence, I'm not sure what kind of information you really want to have.
Maybe you want to know if the DB2 instance is started? Or is it really
DB-specific what you want to know?

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Oct 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Lee Mundie | last post: by
4 posts views Thread by Scott B | last post: by
2 posts views Thread by Naveen Mukkelli | last post: by
2 posts views Thread by Justin | last post: by
6 posts views Thread by =?Utf-8?B?QnNtZW5nZW4=?= | last post: by
11 posts views Thread by Alexnb | last post: by
3 posts views Thread by Alexnb | last post: by
reply views Thread by Alexnb | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.