Subject Re: Should (Could) FBStatements be held in WeakHashMap
Author Roman Rokytskyy
Mark,

Can you provide more details for this example?

> In my case (to help explain why I get such a simple error) it's
> hidden within an instance of an Iterator,object which didn't
> explicitly call the .close() object when scope was lost, and that
> depended upon the whim of the user of reading until the end of the
> result set.

What is hidden in Interator.next()? Statement allocation? Can you
provide some code? (I have a feeling that weak references will not
solve your problem, but even might cause "statement already closed"
errors).

> But I can see this occuring in a program if say Exceptions occur
> occasionally, that then forget to call close(), and it will only be
> after running for 4 days the program will crash after gradually
> slowing down (since they end up having 20,000 open stmts to the
> server).

Correct me, but all JDBC tutorials have typical constructs like:

Statement stmt = null;

try {
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
} finally {
if (stmt != null) stmt.close();
}

don't they?

> (MS JAVA you see was being so
> standards compilant that it would only allow a maximum of two
> concurrent connections to a remote server at one time,

This seems to be IE limitation, try to dowload more than two files
simultaneously from the same server.

Best regards,
Roman