This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The implementation of DatabaseConnection.getJDBCConnection() calls java.sql.Connection.close(), which can possibly block due to thread synchronization or network activity. It does so in order to return a null value if the connection is closed. However, this approach has several problems: 1. Connection.isClosed() is only guaranteed to return false if Connection.close() method has been previously calleed. Therefore in order to be reliable, the implementation of DC.getJDBCConnection() can only call C.isClosed() after the connection has been closed (e.g., by invoking the Disconnect action in the Database Explorer's UI). But then the implementation doesn't need to call C.isClosed() at all, since the fact that the connection has been closed is known (it is even displayed in the UI). 2. The Javadoc of DC.getJDBCConnection(), which states that a null value will be returned if the connection is disconnected, suggests this method can be used to find out the connections state. Imagine a combo box containing all connections with a connected/disconnected icon next to each connection. The usage DC.getJDBCConnection() to determine the icon could lead to an UI freeze. There should be a DC.isConnected() method returning the state of the connection as known by the Database Explorer. DC.getJDBCConnection() should return null iff DC.isConnected() == true.
Sorry, the first line of the description should be: The implementation of DC.getJDCBConnection calls *java.sql.Connection.isClosed()*...
Fixed. Checking in src/org/netbeans/api/db/explorer/DatabaseConnection.java; /cvs/db/src/org/netbeans/api/db/explorer/DatabaseConnection.java,v <-- DatabaseConnection.java new revision: 1.5.2.1.2.2; previous revision: 1.5.2.1.2.1 done Checking in src/org/netbeans/modules/db/explorer/DatabaseConnection.java; /cvs/db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java,v <-- DatabaseConnection.java new revision: 1.39.2.2.2.1; previous revision: 1.39.2.2 done