Search in sources :

Example 1 with GDSType

use of org.firebirdsql.gds.impl.GDSType in project jaybird by FirebirdSQL.

the class FBDriver method connect.

@Override
public FirebirdConnection connect(FirebirdConnectionProperties properties) throws SQLException {
    GDSType type = GDSType.getType(properties.getType());
    if (type == null) {
        type = GDSFactory.getDefaultGDSType();
    }
    FBManagedConnectionFactory mcf = new FBManagedConnectionFactory(type, (FBConnectionProperties) properties).canonicalize();
    FBDataSource dataSource = createDataSource(mcf);
    return (FirebirdConnection) dataSource.getConnection(mcf.getUser(), mcf.getPassword());
}
Also used : FBManagedConnectionFactory(org.firebirdsql.jaybird.xca.FBManagedConnectionFactory) GDSType(org.firebirdsql.gds.impl.GDSType)

Example 2 with GDSType

use of org.firebirdsql.gds.impl.GDSType in project jaybird by FirebirdSQL.

the class FBXADataSource method initialize.

private void initialize() throws SQLException {
    synchronized (lock) {
        if (internalDs != null) {
            return;
        }
        GDSType gdsType = GDSType.getType(getType());
        if (gdsType == null) {
            gdsType = GDSFactory.getDefaultGDSType();
        }
        FBManagedConnectionFactory mcf = new FBManagedConnectionFactory(gdsType, getConnectionProperties());
        mcf.setDefaultConnectionManager(new XAConnectionManager());
        internalDs = (FBDataSource) mcf.createConnectionFactory();
        internalDs.setLogWriter(getLogWriter());
    }
}
Also used : GDSType(org.firebirdsql.gds.impl.GDSType)

Example 3 with GDSType

use of org.firebirdsql.gds.impl.GDSType in project jaybird by FirebirdSQL.

the class TestJaybirdBlobBackupProblem method setUp.

@Before
public void setUp() throws Exception {
    GDSType gdsType = FBTestProperties.getGdsType();
    dbFactory = FBTestProperties.getFbDatabaseFactory();
    try {
        fbManager = new FBManager(gdsType);
        fbManager.setServer("localhost");
        fbManager.setPort(5066);
        fbManager.start();
        File dbFolder = temporaryFolder.newFolder("db");
        mAbsoluteBackupPath = new File(dbFolder, "testES01344.fbk").getAbsolutePath();
        mAbsoluteDatabasePath = new File(dbFolder, "testES01344.fdb").getAbsolutePath();
        fbManager.createDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey");
    } catch (Exception e) {
        log.warn("exception in setup: ", e);
    }
}
Also used : FBManager(org.firebirdsql.management.FBManager) GDSType(org.firebirdsql.gds.impl.GDSType) File(java.io.File)

Example 4 with GDSType

use of org.firebirdsql.gds.impl.GDSType in project jaybird by FirebirdSQL.

the class FBManager method setType.

@Override
public void setType(String type) {
    final GDSType gdsType = GDSType.getType(type);
    if (gdsType == null)
        throw new RuntimeException("Unrecognized type '" + type + "'");
    this.type = gdsType;
}
Also used : GDSType(org.firebirdsql.gds.impl.GDSType)

Example 5 with GDSType

use of org.firebirdsql.gds.impl.GDSType in project jaybird by FirebirdSQL.

the class FBTestProperties method getDefaultSupportInfo.

/**
 * The {@link org.firebirdsql.util.FirebirdSupportInfo} for the default test server.
 *
 * @return Support info object
 */
public static FirebirdSupportInfo getDefaultSupportInfo() {
    try {
        if (firebirdSupportInfo == null) {
            final GDSType gdsType = getGdsType();
            final FBServiceManager fbServiceManager = new FBServiceManager(gdsType);
            if (gdsType == GDSType.getType("PURE_JAVA") || gdsType == GDSType.getType("NATIVE") || gdsType == GDSType.getType("OOREMOTE")) {
                fbServiceManager.setServerName(DB_SERVER_URL);
                fbServiceManager.setPortNumber(DB_SERVER_PORT);
            }
            fbServiceManager.setUser(FBTestProperties.DB_USER);
            fbServiceManager.setPassword(FBTestProperties.DB_PASSWORD);
            firebirdSupportInfo = FirebirdSupportInfo.supportInfoFor(fbServiceManager.getServerVersion());
        }
        return firebirdSupportInfo;
    } catch (Exception e) {
        throw new IllegalStateException("Cannot initialize support info", e);
    }
}
Also used : FBServiceManager(org.firebirdsql.management.FBServiceManager) GDSType(org.firebirdsql.gds.impl.GDSType) SQLException(java.sql.SQLException)

Aggregations

GDSType (org.firebirdsql.gds.impl.GDSType)9 FBManagedConnectionFactory (org.firebirdsql.jaybird.xca.FBManagedConnectionFactory)3 SQLException (java.sql.SQLException)2 File (java.io.File)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 GDSException (org.firebirdsql.gds.GDSException)1 FbConnectionProperties (org.firebirdsql.gds.ng.FbConnectionProperties)1 InvalidPropertyValueException (org.firebirdsql.jaybird.props.InvalidPropertyValueException)1 FBManager (org.firebirdsql.management.FBManager)1 FBServiceManager (org.firebirdsql.management.FBServiceManager)1