How to demermine when db connection is closed

How to demermine when db connection is closed

Post by ToRi » Thu, 16 May 2002 20:20:54



Hi,

I am writing a component(written in VC++ 6.0 IDE, using  MS ADO 2.5) which
has database support and uses MS SQL Server 2000 as a back-end. My component
should behave as it has persistent database connection, I.e. whether it is
possible to provide clients with database connection. That's why, I wish to
make my component to be smart enough to detect database connection closure.
In this case, it should automatically try to reconnect. I try to find some
MSSQL2k error codes for connection closure, but I didn't found anything on
that topic.
I will be thankful if you have some suggestions how to solve my problem.

Best wishes,
ToRiN

 
 
 

How to demermine when db connection is closed

Post by ToRi » Thu, 16 May 2002 21:13:40


I solve the problem. ADO Connection object has a property State which holds
the current state of the object. The State property is ObjectSta*um type,
which contains adStateClosed. So on every ADO generated error  I check for
this item. It works.


Quote:> Hi,

> I am writing a component(written in VC++ 6.0 IDE, using  MS ADO 2.5) which
> has database support and uses MS SQL Server 2000 as a back-end. My
component
> should behave as it has persistent database connection, I.e. whether it is
> possible to provide clients with database connection. That's why, I wish
to
> make my component to be smart enough to detect database connection
closure.
> In this case, it should automatically try to reconnect. I try to find some
> MSSQL2k error codes for connection closure, but I didn't found anything on
> that topic.
> I will be thankful if you have some suggestions how to solve my problem.

> Best wishes,
> ToRiN


 
 
 

1. Help! close() closes multiple db connections

We are running a Swing 1.0 applet in Netscape using 1.1.1 Java Plugin and
jdk1.1.6
using RMI.

Every client gets a copy of its own RMI object which opens a connection to
the database.   The connection is then part of that object.  However when
one client closes his or her connection, other clients' connections
temporarily turn null.  The only time a connection is ever closed is when
one client leaves.  I don't understand how one connection closing could
have an effect on another client's connection.

We had a major problem while using the jdbc-odbc bridge.  Multiple
connections to the database would be opened by each client.   However, it
would end up that multiple clients were getting assigned the same
connection.  Therefore people could not search the database at the same
time.  Right now I have the queries all synchronized, and we are using
weblogic's mssqlserver4 driver, type 4.  When we take out the method to
close a connection, it works fine.  However we end up maxing out on the
number of connections very quickly.  We need to be able to close the
connection for one particular client without affecting any other client
connections.

Could it be that RMI is mixing up which client has access to which Remote
Object.  Or maybe it's a driver issue.  Any insight would be helpful.

Please Help.  Thanks.......
radha

--
Radha Bakshi

Towery Publishing, Inc.

2. Adding usernames to pg_hba.conf

3. onstat -F output

4. OLE DB Close DB Connection w/MSSQL 6.5

5. APPLICATIONS DEVELOPER,Madison,WI

6. Connection::Close doesn't actually close connection?

7. database access via c++ program...

8. closing connection to sql db

9. Close DB connection and Compact

10. close connections to compact db

11. Closing all connections to DB for ADO maintenance

12. When closing a connection, recordset is also closed!