use of org.firebirdsql.management.FBManager in project jaybird by FirebirdSQL.
the class TestV10Database method testAttach_DoubleAttach.
@Test
public void testAttach_DoubleAttach() throws Exception {
expectedException.expect(SQLException.class);
expectedException.expectMessage(equalTo("Already attached to a database"));
FBManager fbManager = createFBManager();
defaultDatabaseSetUp(fbManager);
try (WireDatabaseConnection gdsConnection = createConnection()) {
gdsConnection.socketConnect();
try (FbWireDatabase db = gdsConnection.identify()) {
assertEquals("Unexpected FbWireDatabase implementation", getExpectedDatabaseType(), db.getClass());
db.attach();
// Second attach should throw exception
db.attach();
}
} finally {
defaultDatabaseTearDown(fbManager);
}
}
Aggregations