Package org.hsqldb

Examples of org.hsqldb.Server

From the 'server.properties' file, options can be set similarly, using a slightly different format.

Here is an example 'server.properties' file:

 server.port=9001 server.database.0=test server.dbname.0=... ... server.database.n=... server.dbname.n=... server.silent=true 
Starting with 1.7.2, Server has been refactored to become a simple JavaBean with non-blocking start() and stop() service methods. It is possible to configure a Server instance through the JavaBean API as well, but this part of the public interface is still under review and will not be finalized or documented fully until the final 1.7.2 release.

Note:

The 'no_system_exit' property is of particular interest.

If a Server instance is to run embedded in, say, an application server, such as when the jdbcDataSource or HsqlServerFactory classes are used, it is typically necessary to avoid calling System.exit() when the Server instance shuts down.

By default, 'no_system_exit' is set:

  1. true when a Server is started directly from the start() method.

  2. false when a Server is started from the main(String[]) method.

These values are natural to their context because the first case allows the JVM to exit by default on Server shutdown when a Server instance is started from a command line environment, whereas the second case prevents a typically unwanted JVM exit on Server shutdown when a Server intance is started as part of a larger framework.

Replaces original Hypersonic source of the same name. @author fredt@users @version 1.8.0 @since 1.7.2 @jmx.mbean description="HSQLDB Server" extends="org.hsqldb.mx.mbean.RegistrationSupportBaseMBean" @jboss.xmbean


      props.setProperty("server.silent", "true");
      props.setProperty("server.no_system_exit", "true");
      props.setProperty("server.port", 27862);
      props.setProperty("server.address", ipAddressOrHostName);

      hsqldbServer = new Server();
      hsqldbServer.setLogWriter(null);
      hsqldbServer.setProperties(props);
      hsqldbServer.start();

      log.debug("started " + config.getDatabaseName() + " in-VM");
View Full Code Here


                }
            } catch (NameNotFoundException e) {
            }

            // create the server
            server = new Server();
            // add the silent property
            properties.setProperty(sc_key_silent, "true");
            // set the log and error writers
            server.setLogWriter(new HsqlPrintWriter(false));
            server.setErrWriter(new HsqlPrintWriter(true));
View Full Code Here

        url = "jdbc:hsqldb:hsql://localhost:" + port + "/" + databaseName +";shutdown=true";
        logger.info("Starting Hypersonic Database '" + url + "'.");
        new Thread() {
            @Override
            public void run() {
                Server server = new Server();
                Log targetLogger = LogFactory.getLog("org.hsqldb");
                server.setLogWriter(new PrintWriter(new StdoutToLog4jFilter(server.getLogWriter(), targetLogger)));
                server.setDatabasePath(0, "target/hsql/" + databaseName);
                server.setDatabaseName(0, databaseName);
                server.setNoSystemExit( true );
                server.setSilent( true );
                server.setPort(port);
                server.start();


                hsqlServer = server;
                startGate.countDown();
            }
View Full Code Here

   
    if(serverRequired.get()){
     
      log.info("Starting HSQL standalone DBMS...");
     
      server = new Server();
      lubricantLoggerWriter = new LubricantLoggerWriter(
          hsql,
          new Replace(new OneLogLineForEachFlush()"\\[[\\w\\W]*\\]: ", "") ,
          com.danidemi.jlubricant.slf4j.Logger.TRACE
      );
View Full Code Here

    // the database server
    Server hsqlServer = null;

    public ConnectionUtil(String db_file_name_prefix) throws Exception
    {
        hsqlServer = new Server();
        // HSQLDB prints out a lot of informations when
        // starting and closing, which we don't need now.
        // Normally you should point the setLogWriter
        // to some Writer object that could store the logs.
        //hsqlServer.setLogWriter(null);
View Full Code Here

                }
            } catch (NameNotFoundException e) {
            }

            // create the server
            server = new Server();
            // add the silent property
            properties.setProperty(sc_key_silent, "true");
            // set the log and error writers
            server.setLogWriter(new HsqlPrintWriter(false));
            server.setErrWriter(new HsqlPrintWriter(true));
View Full Code Here

TOP

Related Classes of org.hsqldb.Server

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.