Subject Re: [Firebird-Java] How to get connections count?
Author Roman Rokytskyy
> I use Firebird with Tomcat 5 and get connections by
> DataSource.getConnection()

I will assume that you use our connection pool in Tomcat. If you use a
different one, you have to post question in the corresponding list.

> I have a serious problem, that after some steps getConnection()
> hangs in one point in my app. I know that it can behave like that
> when I forget closing connections so I close them every time.

> But the problem exist and is repeatable. I can log in my app exactly
> 5 times, on the sixth try it hangs. Maybe I forgot to close
> connection somewhere, how can I check it?

You can enable logging and check the log files. For more details see

> Is it possible to see how many connections are in the memory, even
> by debugging into Jaybird sources?

See release notes. Pool classes have runtime properties that tell how many
connections are in the pool and how many are in the application: freeSize,
workingSize and totalSize.

> Or maybe there can be other reasons my getConnection() hangs?
> Especially: should I close Statement after every createStatement()?

You have to close statements all the time because when you write your code
you cannot be sure whether pool with do this for you when you return your
connection back to the pool. Our pool closes all Statement on close() and
pools PreparedStatements.