Package org.hsqldb.jdbc

Examples of org.hsqldb.jdbc.jdbcDataSource


        super(testName);
    }

    private void initHypersonic() throws Exception {

        jdbcDataSource dataSource = new jdbcDataSource();

        dataSource.setDatabase("jdbc:hsqldb:mem:.");

//        dataSource.setDatabase("jdbc:hsqldb:hsql://localhost/yourtest");
        conn = dataSource.getConnection("sa", "");

        conn.setAutoCommit(false);
    }
View Full Code Here


        runTests(runs);
    }

    static void runTests(int runs) throws Exception {

        jdbcDataSource dataSource = new jdbcDataSource();

        dataSource.setDatabase(url);
        conn  = dataSource.getConnection("SA", "");
        stmnt = conn.createStatement();

        println("");
        println("***************************************");
        println("featuring cached (persistent) table");
        println("***************************************");

        // drop and recreate the test table
        println(drop_table_sql);
        stmnt.execute(drop_table_sql);
        println(create_cached + table_sql);
        stmnt.execute(create_cached + table_sql);
        preparedTestOne(runs);

        // drop the test table and shut down database
        println(drop_table_sql);
        stmnt.execute(drop_table_sql);
        println("---------------------------------------");
        println("shutting down database");
        stmnt.execute(shutdown_sql);
        println("---------------------------------------");

        // get the connection and statement
        conn  = dataSource.getConnection("SA", "");
        stmnt = conn.createStatement();

        println("");
        println("***************************************");
        println("featuring memory (persistent) table");
        println("***************************************");

        // drop and recreate the test table
        println(drop_table_sql);
        stmnt.execute(drop_table_sql);
        println(create_memory + table_sql);
        stmnt.execute(create_memory + table_sql);
        preparedTestOne(runs);

        // drop the test table and shut down database
        println(drop_table_sql);
        stmnt.execute(drop_table_sql);
        println("---------------------------------------");
        println("shutting down database");
        stmnt.execute(shutdown_sql);
        println("---------------------------------------");

        // get the connection and statement
        conn  = dataSource.getConnection("SA", "");
        stmnt = conn.createStatement();

        println("");
        println("***************************************");
        println("featuring temp (transient) table");
View Full Code Here

    }

    public static void preparedTestTwo() {

        try {
            jdbcDataSource dataSource = new jdbcDataSource();

            dataSource.setDatabase("jdbc:hsqldb:.");

            Connection con = dataSource.getConnection("SA", "");

            System.out.println("con=" + con);

            Statement stmt = con.createStatement();
View Full Code Here

    public static void test() throws Exception {

        Connection        conn;
        Statement         stmnt;
        PreparedStatement pstmnt;
        jdbcDataSource dataSource = new jdbcDataSource();
        dataSource.setDatabase("jdbc:hsqldb:mem:test");
        conn = dataSource.getConnection("SA", "");
        stmnt  = conn.createStatement();
        pstmnt = conn.prepareStatement("drop table t if exists");

        boolean result = pstmnt.execute();
View Full Code Here

      try {
        testProps.loadFromXML(AbstractServiceTest.class
            .getResourceAsStream("test.properties.xml"));

        // Create the mondrian datasource
        jdbcDataSource ds = new jdbcDataSource();
        ds.setDatabase(getTestProperty("context.database")); //$NON-NLS-1$
        ds.setUser(getTestProperty("context.username")); //$NON-NLS-1$
        ds.setPassword(getTestProperty("context.password")); //$NON-NLS-1$

        // Bind the datasource in the directory
        Context ctx = new InitialContext();
        ctx.bind(getTestProperty("context.jndi"), ds); //$NON-NLS-1$

        // Create the mondrian schema
        Connection c = ds.getConnection();
        Statement stm = c.createStatement();
        slurp(stm,
            AbstractServiceTest.class
                .getResourceAsStream("sampledata.sql")); //$NON-NLS-1$
        stm.executeBatch();
View Full Code Here

  public void setup() throws Exception {
    InputStream inputStream = getClass().getResourceAsStream("../connection.properties");
    testProps.load(inputStream); //$NON-NLS-1$

    jdbcDataSource ds = new jdbcDataSource();
    ds.setDatabase(getTestProperty("name")); //$NON-NLS-1$
    ds.setUser(getTestProperty("username")); //$NON-NLS-1$
    ds.setPassword(getTestProperty("password")); //$NON-NLS-1$


    try {
      Class.forName("org.hsqldb.jdbcDriver");
View Full Code Here

            HsqlProperties props      = new HsqlProperties(filepath);
            boolean        fileexists = props.checkFileExists();

            if (!network && !fileexists == false) {
                jdbcDataSource dataSource = new jdbcDataSource();

                dataSource.setDatabase(url + filepath);

                cConnection = dataSource.getConnection(user, password);
                sStatement  = cConnection.createStatement();

                sStatement.execute("SET SCRIPTFORMAT " + logType);
                sStatement.execute("SET LOGSIZE " + 400);
                sStatement.execute("SET WRITE_DELAY " + writeDelay);
                sStatement.execute("SHUTDOWN");
                cConnection.close();
                props.load();
                props.setProperty("hsqldb.cache_scale", "" + cacheScale);
                props.save();

                cConnection = dataSource.getConnection(user, password);
                sStatement  = cConnection.createStatement();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("TestSql.setUp() error: " + e.getMessage());
View Full Code Here

            sw.zero();

            cConnection = null;
            sStatement  = null;

            jdbcDataSource dataSource = new jdbcDataSource();

            dataSource.setDatabase(url + filepath);

            cConnection = dataSource.getConnection(user, password);

            System.out.println("connected: " + sw.elapsedTime());
            sw.zero();

            sStatement = cConnection.createStatement();
View Full Code Here

    protected void checkResults() {

        try {
            StopWatch      sw = new StopWatch();
            ResultSet      rs;
            jdbcDataSource dataSource = new jdbcDataSource();

            dataSource.setDatabase(url + filepath);

            cConnection = dataSource.getConnection(user, password);

            System.out.println("Reopened database: " + sw.elapsedTime());
            sw.zero();

            sStatement = cConnection.createStatement();
View Full Code Here

    protected void setUp() {

        try {
            createDatabase();

            jdbcDataSource dataSource = new jdbcDataSource();

            dataSource.setDatabase("jdbc:hsqldb:testdb");

            con = dataSource.getConnection("sa", "");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(this + ".setUp() error: " + e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.hsqldb.jdbc.jdbcDataSource

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.