In 2006 I wrote my own JDBC-connection-pooling for Oracle-Connections. I have stored the collections in a Vector and every night I instantiated a new Vector-object to initialize the connection-pool:
connections = new Vector(poolsize);
Thus, all the existing connections were deleted by the garbage-collector and Oracle deleted the connections.
To be honest, it's a very poor solution - but it works for 12 years without problems!
This year we updated our Oracle-version to 12.2.0.1.0 and I updated the Oracle-JDBC-driver in my high-sophisticated programs.
I am currently using the Oracle Database 12.2.0.1 JDBC Driver (ojdbc8.jar), downloaded from this website:
https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html
The database-access is working fine - except my poor connection-pool. After calling "connections = new Vector(poolsize)" the Oracle-DB does NOT remove the open connections, and the amount of open JDBC-connections increase every day - until Oracle breaks down (too many open JDBC-connections).
I know that I must close every JDBC-connection with close() instead of only initialize the Vector holding the collections. But I am wondering why the new Oracle JDBC-driver does not remove all the connections after the garbage-collection was running.
Is this an error from the new JDBC-driver?
In all older JDBC-drivers this error will not occur - it occurs only with the new ojdbc8.jar.
A JDBC-driver should automatically close all database-related objects (for example ResultSets) if there are not reachable. I do not believe that every JDBC-developer will close the ResultSet-objects after the database-operation has finished. I have not tested whether ojdbc8.jar will close these kind of unclosed ResultSet-Objects, but if not, some programs will blow up in the future.
What do you think, is there a bug in the new JDBC-driver because unreachable JDBC-connections were not closed automatically?