|
|
Choosing A Webhost: |
Fwd: How to start a database with jdbc:hsqldb:file:/ //location as the url: msg#00004java.hsqldb.user
Hai Andy, I am also trying to use the same thing for starting the db Can u explain me in detail what are the cases ur handling when u get a sql expception(heartbeat....). I dint understand those constants properly Thanks in advance Rgds Mehar ---------- Forwarded message ---------- From: Heilveil, Andy <alheilveil@xxxxxxxxxxxxxx > Date: Apr 26, 2007 7:31 PM Subject: Re: [Hsqldb-user] How to start a database with jdbc:hsqldb:file:/ //location as the url To: HSQLdb user discussions < hsqldb-user@xxxxxxxxxxxxxxxxxxxxx> This is a fragment of what I
do.
It
lets me handle the lock file still being around from an "abrupt program
termination" (a crash ;).
private void
Connect() throws SQLException {
synchronized (Hypersonic.class) {//#to get rid of 'lazy initialization not thread-safe' warning. if (driver == null) { driver = new org.hsqldb.jdbcDriver(); } //if we do the above when not necessary two copies of the driver get loaded. } try { String url = "" + fullFilePath; log.info("connecting:" +
url);
//noinspection NestedTryStatement try { driver.connect(url, connectionProperties());//user,password, et al. } catch (SQLException e) { int traceCode = -e.getErrorCode(); String sqlState = e.getSQLState(); log.error(MessageFormat.format("database connect failed with traceCode:{0}, sql state:{1}", traceCode, sqlState)); switch (traceCode) { default: //try twice regardless of code, sometimes is wrapped a layer deeper as a generic java.lang.exception whose message is the tracecode. case Trace.LockFile_checkHeartbeat: //quick program restarts caught these case Trace.LockFile_checkHeartbeat2:// although unlocked the lock file has a timestamp that is too fresh. case Trace.DATABASE_ALREADY_IN_USE: deleteLock(); //try one more time. driver.connect(url, connectionProperties()); break; } } //# setWriteDelay is not useful, we
generically call set autocommit ... which has the same effect as this:
setWriteDelay(commitDelaySeconds); //note: schema may not exist yet. createInternals();//has side effect of early indications of trouble. } catch (SQLException e) { int traceCode = e.getErrorCode(); String sqlState = e.getSQLState(); log.error(MessageFormat.format("database connect failed again with traceCode:{0}, sql state:{1}", traceCode, sqlState)); throw e; } } From: hsqldb-user-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:hsqldb-user-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Mehar SVLN Sent: Thursday, April 26, 2007 6:45 AM To: HSQLdb user discussions Subject: [Hsqldb-user] How to start a database with jdbc:hsqldb:file:///location as the url To my knowledge, dabase with url like jdbc:hsqldb:file://// will start when connection is created. Is there a better way to start this database? -- Rgds Mehar ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Hsqldb-user mailing list Hsqldb-user@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/hsqldb-user -- Rgds Mehar ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________ Hsqldb-user mailing list Hsqldb-user@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/hsqldb-user
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: COUNT(*) : the real problem, Dimitri Maziuk |
|---|---|
| Next by Date: | Re: Fwd: How to start a database with jdbc:hsqldb:file:/ //location as the url, Lorna Burnet |
| Previous by Thread: | Re: COUNT(*) : the real problem, Dimitri Maziuk |
| Next by Thread: | Re: Fwd: How to start a database with jdbc:hsqldb:file:/ //location as the url, Lorna Burnet |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |