InitialContext ic = new InitialContext();  ds = new BasicDataSource(); ic.close();
BasicDataSource bds = new BasicDataSource();  bds.setDriverClassName("org.hsqldb.jdbcDriver"); bds.setUsername("sa"); bds.setPassword(""); bds.setUrl(dbURL); bds.setDefaultAutoCommit(false); bds.setDefaultReadOnly(false); bds.setInitialSize(0); bds.setMaxActive(20); bds.setMaxIdle(20); bds.setPoolPreparedStatements(true); bds.setMaxOpenPreparedStatements(0);  ds = bds;
   public void start() throws Exception   {       InitialContext ic = new InitialContext();            ds = new BasicDataSource();      ic.close();      Connection conn = null;            String sql = null;      try      {         conn = ds.getConnection();                  try         {            if (log.isTraceEnabled()) { log.trace("Creating TRANSACTION table"); }            sql = "CREATE TABLE TRANSACTION ( TRANSACTIONID INTEGER, PRIMARY KEY (TRANSACTIONID) )";            conn.createStatement().executeUpdate(sql);         }         catch (SQLException e) {         }                           try         {            if (log.isTraceEnabled()) { log.trace("Creating DELIVERY table"); }            sql = "CREATE TABLE DELIVERY (CHANNELID VARCHAR, MESSAGEID VARCHAR, STOREID VARCHAR, TRANSACTIONID VARCHAR, STATE CHAR, PRIMARY KEY(CHANNELID, MESSAGEID))";            conn.createStatement().executeUpdate(sql);         }         catch (SQLException e) {}                  try         {            if (log.isTraceEnabled()) { log.trace("Creating MESSAGE_REFERENCE table"); }            sql = "CREATE TABLE MESSAGE_REFERENCE (CHANNELID VARCHAR, MESSAGEID VARCHAR, STOREID VARCHAR, TRANSACTIONID VARCHAR, STATE CHAR, PRIMARY KEY(CHANNELID, MESSAGEID))";            conn.createStatement().executeUpdate(sql);         }         catch (SQLException e) {}         if (log.isTraceEnabled()) { log.trace("Creating MESSAGE table"); }         sql = "CREATE TABLE MESSAGE (" +            "MESSAGEID VARCHAR, " +            "RELIABLE BOOLEAN, " +            "EXPIRATION BIGINT, " +            "TIMESTAMP BIGINT, " +            "COREHEADERS OBJECT, " +            "PAYLOAD OBJECT, " +            "TYPE INT, " +            "JMSTYPE VARCHAR, " +            "PRIORITY INT, " +            "CORRELATIONID OBJECT, " +            "DESTINATIONISQUEUE BOOLEAN, " +            "DESTINATION VARCHAR, " +            "REPLYTOISQUEUE BOOLEAN, " +            "REPLYTO VARCHAR, " +            "JMSPROPERTIES OBJECT, " +            "PRIMARY KEY (MESSAGEID))";         try         {            conn.createStatement().executeUpdate(sql);                  }         catch (SQLException e) {}                  //TODO INDEXES      }      finally      {         if (conn != null)         {            try            {               conn.close();            }            catch (Throwable t)            {}         }      }   }