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.
Build: NetBeans IDE Dev (Build 200808061401) VM: Java HotSpot(TM) Client VM, 10.0-b22, Java(TM) SE Runtime Environment, 1.6.0_06-b02 OS: Linux, 2.6.24-19-generic, i386 User Comments: Stacktrace: java.sql.SQLException: Insufficient data while reading from the network - expected a minimum of 6 bytes and received only -1 bytes. The connection has been terminated. at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:0) at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:0) at org.apache.derby.client.am.Statement.execute(Statement.java:0) at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.executeSQLStatement(SQLExecutionHelper.java:554) at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.access$000(SQLExecutionHelper.java:72) at org.netbeans.modules.db.dataview.output.SQLExecutionHelper$5.execute(SQLExecutionHelper.java:402)
Created attachment 67295 [details] stacktrace
1.start IDE. 2.start Java DB server from services tab. 3.right click on one of jdbc:derby connections and select connect from menu. 4.right click on one table and select view data. 5.stop java DB server 6.from sql command result tab click on refresh button 7. exception occur I'm able to reproduce it again and again. * It seems it relate to Issue 143796 but in another way and with different exception.
Created attachment 67296 [details] stacktrace
I found that it can be reproduce by clicking on other buttons from sql command result tab
Well, yes, of course it occurs because you just shut down the server, and the JDBC connection is trying to talk to a server that is no longer there. What do you expect to happen in this situation?
Thanks for checking it out, I think showing exception menu in final product is not very good idea. so just printing out a text message to show the user that server is shut down is better, I think.
Oh, I see, it's the presentation. I have to think about that, because each JDBC driver has a different way of saying the database is disconnected. I think the enhancement here is to do a better job of displaying errors when there is an exception for the driver. Changing the title of the bug and changing it to an enhancement request.
Sorry, but I disagree. Turning the unexpected exception dialog into a friendlier error message for a deterministic exception can't be the subject of an enhancement request. It is a defect and we should make sure the exception is not thrown to begin with. Perhaps we really need that test() method in issue 122944.
By the way, this will be a dataview issue once a means to test the connection is in place.
If I can translate what you're suggesting, it's that we should be able to detect if a connection is still valid? Or are you also saying the way we report exceptions in general needs to be adjusted. If it's the latter, isn't that an enhancement? Anyway, we should at least be checking for Connection.isClosed() before submitting a query, but I'm not sure all JDBC driver vendors will check the network connection when you call isClosed().
OK, I'm going to go ahead and try to fix this. I need to implement Issue 122944 (add a test() method) and then ahi if you can test your connection before you use it. We will probably need to add tests elsewhere inside our code, but this is one of the main places it's needed.
Changed dependent bug to the one focused on the test() method
Hi, Ahi. Once 143837 passes API review you can use the test() method to address this in the dataview module...
http://hg.netbeans.org/main/rev/d6de54097bda
Verified with build 080828.
Integrated into 'main-golden', available in build *200808281401* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/d6de54097bda User: ahimanikya@netbeans.org Log: #143798 [65cat] Test for a connection before using it in SQL Editor