Java Code Examples for org.hsqldb.Server#setLogWriter()
The following examples show how to use
org.hsqldb.Server#setLogWriter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcHdfsDatabaseConfiguration.java From spring-cloud-task-app-starters with Apache License 2.0 | 6 votes |
@Bean(destroyMethod = "stop") public Server databaseServer() throws SQLException, IOException, ServerAcl.AclFormatException { DriverManager.registerDriver(new org.hsqldb.jdbcDriver()); int hsqldbPort = SocketUtils.findAvailableTcpPort(10000); System.setProperty("db.server.port", Integer.toString(hsqldbPort)); logger.info("Database is using port: " + Integer.toString(hsqldbPort)); HsqlProperties configProps = new HsqlProperties(); configProps.setProperty("server.port", hsqldbPort); configProps.setProperty("server.database.0", "file:target/db/test"); configProps.setProperty("server.dbname.0", "test"); Server server = new Server(); server.setLogWriter(null); server.setErrWriter(null); server.setRestartOnShutdown(false); server.setNoSystemExit(true); server.setProperties(configProps); server.start(); return server; }
Example 2
Source File: SqoopToolDatabaseConfiguration.java From spring-cloud-task-app-starters with Apache License 2.0 | 6 votes |
@Bean(destroyMethod = "stop") public Server databaseServer() throws SQLException, IOException { DriverManager.registerDriver(new org.hsqldb.jdbcDriver()); int hsqldbPort = SocketUtils.findAvailableTcpPort(10000); System.setProperty("db.server.port", Integer.toString(hsqldbPort)); logger.info("Database is using port: " + Integer.toString(hsqldbPort)); HsqlProperties configProps = new HsqlProperties(); configProps.setProperty("server.port", hsqldbPort); configProps.setProperty("server.database.0", "file:target/db/test"); configProps.setProperty("server.dbname.0", "test"); Server server = new org.hsqldb.Server(); server.setLogWriter(null); server.setErrWriter(null); server.setRestartOnShutdown(false); server.setNoSystemExit(true); server.setProperties(configProps); server.start(); return server; }
Example 3
Source File: JqmBaseTest.java From jqm with Apache License 2.0 | 6 votes |
@BeforeClass public static void testInit() throws Exception { if (db == null) { JndiContext.createJndiContext(); // If needed, create an HSQLDB server. String dbName = System.getenv("DB"); if (dbName == null || "hsqldb".equals(dbName)) { s = new Server(); s.setDatabaseName(0, "testdbengine"); s.setDatabasePath(0, "mem:testdbengine"); s.setLogWriter(null); s.setSilent(true); s.start(); } // In all cases load the datasource. (the helper itself will load the property file if any). db = Helpers.getDb(); } }
Example 4
Source File: HsqlTestUtils.java From CogStack-Pipeline with Apache License 2.0 | 5 votes |
public static void initHSQLDBs() throws IOException, ServerAcl.AclFormatException { HsqlProperties p1 = new HsqlProperties(); p1.setProperty("server.database.0", "mem:hsqldb"); p1.setProperty("server.dbname.0", "minicogs"); p1.setProperty("server.port", "9001"); p1.setProperty("server.remote_open", "true"); server1 = new Server(); server1.setProperties(p1); server1.setLogWriter(null); server1.setErrWriter(null); server1.start(); HsqlProperties p2 = new HsqlProperties(); p2.setProperty("server.database.0", "mem:hsqldb"); p2.setProperty("server.dbname.0", "minicogs"); p2.setProperty("server.port", "9002"); p2.setProperty("server.remote_open", "true"); server2 = new Server(); server2.setProperties(p2); server2.setLogWriter(null); server2.setErrWriter(null); server2.start(); //yodieconfig //Properties prop = System.getProperties(); //prop.setProperty("at.ofai.gate.modularpipelines.configFile", "/home/rich/gate-apps/yodie/yodie-pipeline/main-bio/main-bio.config.yaml"); }
Example 5
Source File: HsqldbServer.java From scheduling with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void startUp() throws Exception { server = new Server(); server.setProperties(hsqlProperties); server.setErrWriter(null); server.setLogWriter(null); server.start(); }
Example 6
Source File: AbstractHsqldbMojo.java From hsqldb-maven-plugin with Apache License 2.0 | 5 votes |
protected void setup() throws MojoExecutionException { if (getLog().isDebugEnabled()) { getLog().debug("Setting up HSQLDB server with :"); getLog().debug("\taddress : " + address); getLog().debug("\tport : " + (port == 0 ? "default" : port)); getLog().debug("\tname : " + name); getLog().debug("\tpath : " + path); getLog().debug("\tconnection URI : " + getConnectionURI()); getLog().debug("\tdriver : " + driver); getLog().debug("\tvalidation query : " + validationQuery); getLog().debug("\tskip : " + skip); } try { server = new Server(); // TODO : user Maven logger server.setLogWriter(null); server.setSilent(true); server.setAddress(address); if (port > 0) { server.setPort(port); } server.setDatabaseName(0, name); server.setDatabasePath(0, path); } catch (Exception e) { throw new MojoExecutionException(e.getMessage(), e); } }
Example 7
Source File: TestDBStorage.java From spork with Apache License 2.0 | 5 votes |
public TestDBStorage() throws ExecException, IOException { // Initialise Pig server cluster = MiniCluster.buildCluster(); pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); pigServer.getPigContext().getProperties() .setProperty(MRConfiguration.MAP_MAX_ATTEMPTS, "1"); pigServer.getPigContext().getProperties() .setProperty(MRConfiguration.REDUCE_MAX_ATTEMPTS, "1"); System.out.println("Pig server initialized successfully"); TMP_DIR = System.getProperty("user.dir") + "/build/test/"; dblocation = TMP_DIR + "batchtest"; url = "jdbc:hsqldb:file:" + dblocation + ";hsqldb.default_table_type=cached;hsqldb.cache_rows=100"; // Initialise DBServer dbServer = new Server(); dbServer.setDatabaseName(0, "batchtest"); // dbServer.setDatabasePath(0, "mem:test;sql.enforce_strict_size=true"); dbServer.setDatabasePath(0, "file:" + TMP_DIR + "batchtest;sql.enforce_strict_size=true"); dbServer.setLogWriter(null); dbServer.setErrWriter(null); dbServer.start(); System.out.println("Database URL: " + dbUrl); try { Class.forName(driver); } catch (Exception e) { e.printStackTrace(); System.out.println(this + ".setUp() error: " + e.getMessage()); } System.out.println("Database server started on port: " + dbServer.getPort()); }
Example 8
Source File: Common.java From jqm with Apache License 2.0 | 5 votes |
static Server createHsqlServer() { Server s = new Server(); String dbName = "testdb_" + Math.random(); s.setDatabaseName(0, dbName); s.setDatabasePath(0, "mem:" + dbName); s.setLogWriter(null); s.setSilent(true); return s; }
Example 9
Source File: DbTest.java From netcrusher-java with Apache License 2.0 | 4 votes |
@Before public void setUp() throws Exception { reactor = new NioReactor(); crusher = TcpCrusherBuilder.builder() .withReactor(reactor) .withBindAddress("127.0.0.1", CRUSHER_PORT) .withConnectAddress("127.0.0.1", DB_PORT) .buildAndOpen(); hsqlServer = new Server(); hsqlServer.setAddress("127.0.0.1"); hsqlServer.setPort(DB_PORT); hsqlServer.setDaemon(true); hsqlServer.setErrWriter(new PrintWriter(System.err)); hsqlServer.setLogWriter(new PrintWriter(System.out)); hsqlServer.setNoSystemExit(true); hsqlServer.setDatabasePath(0, "mem:testdb"); hsqlServer.setDatabaseName(0, "testdb"); hsqlServer.start(); Class.forName("org.hsqldb.jdbc.JDBCDriver"); BoneCPConfig config = new BoneCPConfig(); config.setJdbcUrl(String.format("jdbc:hsqldb:hsql://127.0.0.1:%d/testdb", CRUSHER_PORT)); config.setUsername("sa"); config.setPassword(""); config.setInitSQL(SQL_CHECK); config.setConnectionTestStatement(SQL_CHECK); config.setAcquireIncrement(1); config.setAcquireRetryAttempts(1); config.setAcquireRetryDelayInMs(1000); config.setConnectionTimeoutInMs(1000); config.setQueryExecuteTimeLimitInMs(1000); config.setDefaultAutoCommit(false); config.setDefaultReadOnly(true); config.setDefaultTransactionIsolation("NONE"); config.setPartitionCount(1); config.setMinConnectionsPerPartition(1); config.setMaxConnectionsPerPartition(1); config.setLazyInit(true); config.setDetectUnclosedStatements(true); connectionPool = new BoneCP(config); }