Package org.apache.derby.jdbc

Examples of org.apache.derby.jdbc.ClientDataSource


            gotEx = null;
            try
            {
                String connectionURL =
                    slaveDatabasePath + FS + slaveDbSubPath + FS + replicatedDb;
                ClientDataSource ds = new ClientDataSource();
                ds.setDatabaseName(connectionURL);
                ds.setServerName(slaveServerHost);
                ds.setPortNumber(slaveServerPort);
                ds.getConnection().close();
                util.DEBUG("Successfully connected after shutdown: " +
                           connectionURL);
                break;
            }
            catch (SQLException se)
View Full Code Here


   
    private SQLException _connectToSlave(String slaveServerHost,
            int slaveServerPort,
            String dbPath) {
        util.DEBUG("_connectToSlave");
        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
        ds.setDatabaseName(dbPath);
        ds.setServerName(slaveServerHost);
        ds.setPortNumber(slaveServerPort);
        ds.setConnectionAttributes(useEncryption(false));
        try {
            Connection conn = ds.getConnection(); //
            conn.close();
            return null; // If successfull -
        } catch (SQLException se) {
            util.DEBUG(se.getErrorCode()+" "+se.getSQLState()+" "+se.getMessage());
            return se;
View Full Code Here

    private SQLException _internal_stopSlave(String slaveServerHost,
            int slaveServerPort,
            String dbPath) {
        util.DEBUG("_internal_stopSlave");
        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
        ds.setDatabaseName(dbPath);
        ds.setServerName(slaveServerHost);
        ds.setPortNumber(slaveServerPort);
        ds.setConnectionAttributes("internal_stopslave=true"
                +useEncryption(false));
        try {
            Connection conn = ds.getConnection(); //
            conn.close();
            return null; // If successfull -
        } catch (SQLException se) {
            util.DEBUG(se.getErrorCode()+" "+se.getSQLState()+" "+se.getMessage());
            return se;
View Full Code Here

       
    private Connection _getConnection(String databasePath, String dbSubPath,
            String dbName, String serverHost, int serverPort)
        throws SQLException
    {
        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
        ds.setDatabaseName(databasePath +FS+ dbSubPath +FS+ dbName);
        ds.setServerName(serverHost);
        ds.setPortNumber(serverPort);
        ds.setConnectionAttributes(useEncryption(false));
        return ds.getConnection();
    }
View Full Code Here

                // expect 08006 on successful shutdown
                assertSQLState("08006", e);
            }
            assertTrue(conn.isClosed());
        } else if (usingDerbyNetClient()) {
            ClientDataSource ds = (ClientDataSource) JDBCDataSource
                    .getDataSource();
            ds.setConnectionAttributes("shutdown=true");
            try {
                ds.getConnection();
                fail("expected shutdown to fail");
            } catch (SQLException e) {
                // expect 08006 on successful shutdown
                assertSQLState("08006", e);
            }
View Full Code Here

        String sState = "CONNECTED";
        String msg = null;
        Thread.sleep(waitTime); // .... until stable...
        try
        {
            ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
            ds.setDatabaseName(fullDbPath);
            ds.setServerName(serverHost);
            ds.setPortNumber(serverPort);
            ds.setConnectionAttributes(useEncryption(false));
            Connection conn = ds.getConnection();
            conn.close();
        }
        catch ( SQLException se )
        {
            errCode = se.getErrorCode();
View Full Code Here

        String msg = null;
        while (true)
        {
            try
            {
                ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
                ds.setDatabaseName(fullDbPath);
                ds.setServerName(serverHost);
                ds.setPortNumber(serverPort);
                ds.setConnectionAttributes(useEncryption(false));
                Connection conn = ds.getConnection();
                util.DEBUG("Wait Got connection after "
                        + (count-1) +" * "+ sleepTime + " ms.");
                conn.close();
                return;
            }
View Full Code Here

        String msg = null;
        while (true)
        {
            try
            {
                ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
                ds.setDatabaseName(fullDbPath);
                ds.setServerName(serverHost);
                ds.setPortNumber(serverPort);
                ds.setConnectionAttributes(useEncryption(false));
                Connection conn = ds.getConnection();
                // Should never get here!
                conn.close();
                assertTrue("Expected SQLState'"+expectedState
                            + "', but got connection!",
                        false);
View Full Code Here

                     * using DriverManager.getConnection() concurrently
                     * in startMaster and startSlave!
                    Class.forName(DRIVER_CLASS_NAME); // Needed when running from classes!
                    conn = DriverManager.getConnection(URL);
                     */
                    ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
                    ds.setDatabaseName(masterDatabasePath+FS+masterDbSubPath+FS+dbName);
                    ds.setServerName(masterHost);
                    ds.setPortNumber(masterServerPort);
                    ds.setConnectionAttributes("startMaster=true"
                            +";slaveHost="+slaveReplInterface
                            +";slavePort="+slaveReplPort
                            +useEncryption(false));
                    conn = ds.getConnection();
                   
                    done = true;
                    conn.close();
                    util.DEBUG("startMaster_direct connected in " + count + " * 100ms.");
                }
View Full Code Here

                         * using DriverManager.getConnection() concurrently
                         * in startMaster and startSlave!
                        Class.forName(DRIVER_CLASS_NAME); // Needed when running from classes!
                        conn = DriverManager.getConnection(URL);
                         */
                        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
                        ds.setDatabaseName(fDbPath);
                        ds.setServerName(fSlaveHost);
                        ds.setPortNumber(fSlaveServerPort);
                        ds.setConnectionAttributes(fConnAttrs);
                        conn = ds.getConnection();
                        conn.close();
                    }
                    catch (SQLException se)
                    {
                        startSlaveException = se;
View Full Code Here

TOP

Related Classes of org.apache.derby.jdbc.ClientDataSource

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.