Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Fwd: How to start a database with jdbc:hsqldb:file:/ //location as the url: msg#00004

java.hsqldb.user

Subject: Fwd: How to start a database with jdbc:hsqldb:file:/ //location as the url


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

Hai friends

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>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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

Navigation