A simpler way could be:
// depends on how you handle the PB
PersistanceBroker br = PersistenceBrokerFactory.defaultPersistenceBroker();
Connection conn = br.serviceConnectionManager().getConnection();
// here you can do any checks on the conn Object (is closed, sample query
...).
Roland Ribi
-Original Message-
From: Hiller, Frank RD-AS2 [mailto:[EMAIL PROTECTED]
Sent: Friday, September 02, 2005 9:50 AM
To: OJB Users List
Subject: AW: How to check if database is available
Hi Tom,
ok, I did that.
I read the parameters for the database (protocol,
subprotocol, ...) from database_repository.xml.
Then I try to establish a connection to the DB. If that fails
the DB is not available.
You don't think this could be a functionality that PB API
could provide?
Frank
-Ursprüngliche Nachricht-
Von: Thomas Dudziak [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 19. August 2005 09:48
An: OJB Users List
Betreff: Re: How to check if database is available
On 8/19/05, Hiller, Frank RD-AS2 [EMAIL PROTECTED] wrote:
how can one check via OJB whether the database is avaialable before
establishing a connection to it?
I think that in JDBC you'd have to try to establish a
connection to it and if that fails, then likely the database
is not available (for whatever reason). AFAIK there is no
other generic way (though individual databases may provide
other means).
Since OJB builds upon JDBC, you probably got to try to
establish a connection and execute the query that you've
defined as the keep-alive query, and see whether this is possible.
Tom
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Confidentiality note:
The information in this email and any attachment may contain
confidential and proprietary information of Heidelberger
Druckmaschinen AG and/or its affiliates and may be privileged
or otherwise protected from disclosure. If you are not the
intended recipient, you are hereby notified that any review,
reliance or distribution by others or forwarding without
express permission is strictly prohibited and may cause
liability. In case you have received this message due to an
error in transmission, we kindly ask you to notify the sender
immediately and to delete this email and any attachment from
your system.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]