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

Testing for a Connection

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.