Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / February 2006

Tip: Looking for answers? Try searching our database.

Test database connection using C++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michel Esber - 24 Feb 2006 15:07 GMT
Hello,

DB2 V7 FP14 running Linux.

Our application constantly tests whether the database connection is
still alive before sending new statements to the DB. A "values current
timestamp" statement is issued and, if there is no database exception,
the connection acquired is considered to be alive.

During one of my event monitors, this statement was by far the most
executed in the DB.

I personally dislike this solution. Just wondering if there is any
simpler solution / API for this. We are using C++.

TIA, Michel.
Knut Stolze - 24 Feb 2006 15:13 GMT
> Hello,
>
[quoted text clipped - 4 lines]
> timestamp" statement is issued and, if there is no database exception,
> the connection acquired is considered to be alive.

How about simply sending the intended SQL statement and then handling the
error afterwards if there is one?

The pinging is equally unreliable as the connection might break down between
the ping and the actual start of the execution of the SQL statement.  So
even then you have to handle a broken connection as part of the usual error
handling.

Signature

Knut Stolze
DB2 Information Integration Development
IBM Germany

Peri - 27 Feb 2006 10:39 GMT
Michel,
You might want to look at the db2gDatabasePing API whose prerequisite
is connection.
For futher information
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.
udb.doc/admin/r0001915.htm


>Hello,
>
[quoted text clipped - 12 lines]
>
>TIA, Michel.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.