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.
1) Connect to a DB server with DB explorer in Runtime tab 2) expand some nodes of the DB connection, execute some queries, invoke View Data action ,... (everything works) 3) shutdown the DB server 4) continue to work with the active DB connection in Runtime tab Now if you expand a table node in the connection or if you invoke View Data on the table, you don't get any message that the connection is not active, but the actions don't work as expected. Unless you look into java console of Netbeans where the following exception appears java.sql.SQLException: No operations allowed after connection closed you don't have a clue that the connection is inactive.
There is no acceptable way how to be informed if the connection is active or not. It would be possible to send every few seconds a request to the database if it is alive or not but it seems to me as bad solution from performance point of view. The communication with the database is influenced by network, database loading, etc. It means that if there is a temporary network problem or the database is overloaded by another operation, the response to our question can be slow or it can be timeouted. How should we deal with that (we don't know at this moment if it is alive or not)? The other problem is that each driver vender provides its own error messages. So "java.sql.SQLException: No operations allowed after connection closed" id provided by one driver and another driver will show different message. We are not able to understand what is the problem from SQLException. From my point of view the described usecase is not common. The database is usually running on independent server and database developer normally doesn't stop it as described. Closing as WONTFIX.
Why don't you simply display the message of the exception to the user? For example like JDBC driver message: No operations allowed after connection closed
It seems reasonable. Andrei, could you please look at it?
Yes, this approach sounds reasonable and seems already used almost everywhere (for example when using the View Data action or adding database elements). The only place where I don't get a message is the tree of database elements (when you refresh a node or expand it for the first time). Checking in libsrc/org/netbeans/lib/ddl/impl/DriverSpecification.java; /cvs/db/libsrc/org/netbeans/lib/ddl/impl/DriverSpecification.java,v <-- DriverSpecification.java new revision: 1.19; previous revision: 1.18 done Checking in src/org/netbeans/modules/db/explorer/DatabaseNodeChildren.java; /cvs/db/src/org/netbeans/modules/db/explorer/DatabaseNodeChildren.java,v <-- DatabaseNodeChildren.java new revision: 1.38; previous revision: 1.37 done Checking in src/org/netbeans/modules/db/explorer/actions/RefreshChildrenAction.java; /cvs/db/src/org/netbeans/modules/db/explorer/actions/RefreshChildrenAction.java,v <-- RefreshChildrenAction.java new revision: 1.15; previous revision: 1.14 done Checking in src/org/netbeans/modules/db/resources/Bundle.properties; /cvs/db/src/org/netbeans/modules/db/resources/Bundle.properties,v <-- Bundle.properties new revision: 1.93; previous revision: 1.92 done
Looks good. Thanks.