You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Hiller, Frank RD-AS2" <Fr...@heidelberg.com> on 2005/09/02 09:50:17 UTC

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:tomdzk@gmail.com] 
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 <Fr...@heidelberg.com> 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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org



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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: How to check if database is available

Posted by Thomas Dudziak <to...@gmail.com>.
On 9/2/05, Hiller, Frank RD-AS2 <Fr...@heidelberg.com> wrote:

> 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?

You misunderstood me, I was suggesting that you simply try to
establish a connection *via* the PB - much in the same way as Ribi was
suggesting, or perhaps by executing a simple query with the broker
instance - not outside of OJB (of course this would work too).

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org