Subject | Bug getting Connection |
---|---|
Author | Carsten Schaefer |
Post date | 2001-09-30T14:36:37Z |
Hi,
There is a serious bug in Interclient when getting a
connection to Interbase/Firebird.
This bug was more than one time reported in various IB/FB
newsgroups
but is not solved yet.
The bug is that in a multi connection enviorment
after some time Interclient throws UnavailableDatabaseExceptions. Then no
new connection can be established. Users that have connections can
work as normal.
If some connections are closed than new connections are
established again.
I have written a test programm that shows the bug after some
time.
I tested it on Win2000SP2 and on WinNTSP6 with
FirebirdBeta2/OpenSourceInterbase and Interclient 2.0.2 from the trail with the
patch.
The exception is thrown in the method remote_ATTACH_DATABASE()
of the Class Connection where recvMsg.get_SUCCESS () returns false and so
the following exception is
thrown.(interbase.interclient.UnavailableInterBaseServerException:
[interclient][interbase] unavailable database)
TestCode:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DriverManager;
public class IBConnectionTest {
final static int MAX = 30;
final static int LOOP = 100;
static String url = "jdbc:interbase://localhost/D:/ib_datenbanken/dbams_haendle.gdb";
static int z = 0;
final static int MAX = 30;
final static int LOOP = 100;
static String url = "jdbc:interbase://localhost/D:/ib_datenbanken/dbams_haendle.gdb";
static int z = 0;
public IBConnectionTest() {
try {
Class.forName("interbase.interclient.Driver");
} catch (Exception ex) {
}
ConnectionThread cT = new ConnectionThread();
cT.start();
ConnectionThread cT2 = new ConnectionThread();
cT2.start();
ConnectionThread cT3 = new ConnectionThread();
cT3.start();
}
public static void main(String[] args) {
new IBConnectionTest();
}
public class ConnectionThread extends Thread {
Connection[] ac = new Connection[MAX];
public void run() {
try {
for (int loop = 0; loop < LOOP; loop++) {
for (int i = 0; i < MAX; i++) {
synchronized (ConnectionThread.class) {
System.out.print("getting connecion number " + i);
ac[i] = DriverManager.getConnection(url, "sysdba", "masterkey");
z++;
System.out.println(" successfully Nr:" + z);
}
}
for (int i = 0; i < MAX; i++) {
synchronized (ConnectionThread.class) {
System.out.print("closing connecion number " + i);
((Connection)ac[i]).close();
System.out.println(" successfully");
}
}
}
} catch (Exception e) {
System.out.println("Exception: " + e);
e.printStackTrace();
}
}
}
}
It's very important that someone looks at it because at the moment
IB/Firebird with Interclient is not usable with multi-connections.
gruse
Carsten