Java Code Examples for org.hsqldb.persist.HsqlProperties#getIntegerProperty()

The following examples show how to use org.hsqldb.persist.HsqlProperties#getIntegerProperty() . 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: TestCacheSize.java    From evosql with Apache License 2.0 5 votes vote down vote up
public static void main(String[] argv) {

        TestCacheSize  test  = new TestCacheSize();
        HsqlProperties props = HsqlProperties.argArrayToProps(argv, "test");

        test.bigops   = props.getIntegerProperty("test.bigops", test.bigops);
        test.bigrows  = test.bigops;
        test.smallops = test.bigops / 8;
        test.cacheScale = props.getIntegerProperty("test.scale",
                test.cacheScale);
        test.tableType = props.getProperty("test.tabletype", test.tableType);
        test.nioMode   = props.isPropertyTrue("test.nio", test.nioMode);

        if (props.getProperty("test.dbtype", "").equals("mem")) {
            test.filepath = "mem:test";
            test.filedb   = false;
            test.shutdown = false;
        }

        test.setUp();

        StopWatch sw = new StopWatch();

        test.testFillUp();
        test.checkResults();

        long time = sw.elapsedTime();

        test.storeResult("total test time", 0, (int) time, 0);
        System.out.println("total test time -- " + sw.elapsedTime() + " ms");
        test.tearDown();
    }
 
Example 2
Source File: JDBCConnection.java    From evosql with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs a new external <code>Connection</code> to an HSQLDB
 * <code>Database</code>. <p>
 *
 * This constructor is called on behalf of the
 * <code>java.sql.DriverManager</code> when getting a
 * <code>Connection</code> for use in normal (external)
 * client code. <p>
 *
 * Internal client code, that being code located in HSQLDB SQL
 * functions and stored procedures, receives an INTERNAL
 * connection constructed by the {@link
 * #JDBCConnection(org.hsqldb.SessionInterface)
 * JDBCConnection(SessionInterface)} constructor. <p>
 *
 * @param props A <code>Properties</code> object containing the connection
 *      properties
 * @exception SQLException when the user/password combination is
 *     invalid, the connection url is invalid, or the
 *     <code>Database</code> is unavailable. <p>
 *
 *     The <code>Database</code> may be unavailable for a number
 *     of reasons, including network problems or the fact that it
 *     may already be in use by another process.
 */
public JDBCConnection(HsqlProperties props) throws SQLException {

    String user     = props.getProperty("user");
    String password = props.getProperty("password");
    String connType = props.getProperty("connection_type");
    String host     = props.getProperty("host");
    int    port     = props.getIntegerProperty("port", 0);
    String path     = props.getProperty("path");
    String database = props.getProperty("database");
    boolean isTLS = (DatabaseURL.S_HSQLS.equals(connType)
                     || DatabaseURL.S_HTTPS.equals(connType));
    boolean isTLSWrapper = props.isPropertyTrue(HsqlDatabaseProperties.url_tls_wrapper, false);

    isTLSWrapper &= isTLS;

    if (user == null) {
        user = "SA";
    }

    if (password == null) {
        password = "";
    }

    Calendar cal         = Calendar.getInstance();
    int      zoneSeconds = HsqlDateTime.getZoneSeconds(cal);

    try {
        if (DatabaseURL.isInProcessDatabaseType(connType)) {

            /**
             * @todo - fredt - this should be the only static reference to
             * a core class (apart form references to the Type package)
             * from the jdbc package - we might make it dynamic
             */
            sessionProxy = DatabaseManager.newSession(connType, database,
                    user, password, props, null, zoneSeconds);
        } else if (DatabaseURL.S_HSQL.equals(connType)
                   || DatabaseURL.S_HSQLS.equals(connType)) {
            sessionProxy = new ClientConnection(host, port, path,
                    database, isTLS, isTLSWrapper, user, password, zoneSeconds);
            isNetConn = true;
        } else if (DatabaseURL.S_HTTP.equals(connType)
                   || DatabaseURL.S_HTTPS.equals(connType)) {
            sessionProxy = new ClientConnectionHTTP(host, port, path,
                    database, isTLS, isTLSWrapper, user, password, zoneSeconds);
            isNetConn = true;
        } else {    // alias: type not yet implemented
            throw JDBCUtil.invalidArgument(connType);
        }
        sessionProxy.setJDBCConnection(this);

        connProperties   = props;
        clientProperties = sessionProxy.getClientProperties();

        setLocalVariables();
    } catch (HsqlException e) {
        throw JDBCUtil.sqlException(e);
    }
}