Subject Type 4 driver - closing connection takes eternity
Author Kenneth Foo
Hi, I'm having a problem using the Type 4 driver whereby the
opened connection takes a long time to close, especially after performing
a batch insert operation. (Source code below)

It took me only roughly 1 second to perform 100 inserts,
but 75 seconds to close the connection after that (?).

I tried inserting 1000 items, and my patience ran out before the connection
actually closed. (I've waited close to 5 to 10 minutes, and it still hasn't
closed).

Processor usage is 0% during the wait.

I usually end up terminating my app. Next time I tried to run the app again,
Interbase deadlocked. Sigh.

Any solutions? (or at least know a workaround)

Thanks!

Kenneth

[CODE BELOW]


import java.sql.*;
import org.firebirdsql.jdbc.*;

public class TestFB {

public TestFB() {
}

public static void main (String args[]) {

try {
Class.forName("org.firebirdsql.jdbc.FBDriver");
Connection con =
DriverManager.getConnection("jdbc:firebirdsql:localhost:x:/db/ncsdb.gdb",
"SYSDBA", "masterkey");
con.setAutoCommit(true);
Statement statement = con.createStatement();
statement.executeUpdate("DELETE FROM MESSAGES WHERE ID>=1000 AND
FOLDER_ID=999;");

PreparedStatement ps = con.prepareStatement("INSERT INTO
MESSAGES (ID,FOLDER_ID) VALUES(?,?);");
con.setAutoCommit(true);

long l1 = System.currentTimeMillis();
for (int v = 0; v<1000; v++) {
ps.clearParameters();
ps.setLong(1, 1000+v);
ps.setLong(2, 999);
ps.executeUpdate();
}

System.out.println("FINISHED INSERT...");

ps.close();

long l2 = System.currentTimeMillis();
System.out.println(l2-l1);

System.out.println("CLOSING CONNECTION...");

con.close();

long l3 = System.currentTimeMillis();
System.out.println(l3-l2);

System.out.println("DONE!");
}
catch (Exception ex) {
ex.printStackTrace();
}

}

}