Hello Bruce, We are using MySql 4.0.13
Does Castor work with Pervasive.SQL if you know? Does anybody else have any experience with Pervasive.SQL? Thanks, Sandeep. -----Original Message----- From: Bruce Snyder [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 11:01 PM To: [EMAIL PROTECTED] Subject: Re: [castor-dev] Jdo.getDatabase() ISSUE This one time, at band camp, Sandeep Bhasin said: SB>We are trying to detect the situation where database is down. SB> SB>We were expecting that when we do jdo.getDatabase() it will throw SB>exception, however it simply returns a db reference SB> SB>Db.begin() also doesn't throw an exception. SB> SB>Only when I do db.getOQLQuery() that I actually get an exception. SB> SB>The "PersistenceException" that I get, on that when I do SB>persistenceException.getException(), I am able to get a SQLException. SB>However the error code for the SQLException is not set. Because SB>sqlexception.getErrorCode() returns 0. SB> SB>Why does jdo.getDatabase() take some time, when it is actually not SB>connecting to db? SB> SB>What is the best way for me to find out that database is down? I am SB>even prepared to execute a dummy query but since I get back a generic SB>exception and sql error code is not set, how best to proceed. SB> SB>Your advise is most welcome. Sandy, The call to jdo.getDatabase() grabs some configuration info from the database descriptor, potentially sets up Database object pooling, sets up a transaction and performs some other setup related to the Database object. This all takes some time to set up. The reason that the call to getDatabase() doesn't return a JDBC connection is because the connection is not truly needed until an OQL query is executed or load() is called. In fact, the call to getOQLQuery() does not grab a connection either. It's the call to OQLQuery.execute() that actually fetches and uses the connection. The Javadocs for getDatabse() are actually incorrect because they do state that a connection is opened and returned. This should be changed. If you simply want to test whether the database is up or not, I supposed that you could make use of DatabaseImpl.getConnection(). But just like the Javadocs state, don't close this connection. BTW, what database are you using? Bruce -- perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");' ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev **************************Disclaimer************************************ Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. *************************************************************************** ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
