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. Add MS SQL Server driver. 2. Add connection to MS SQL Server. 3. Expand "Tables" node and disconnect. 4. Connect again, rightclick and choose "Refresh". Result: Error message appears.
Created attachment 69941 [details] Screenshot of "Error" message.
It is true the connection is closed. What is it you are looking for? A better error message that doesn't say "Unable to refresh children"? Would you prefer that we offer to reconnect to the database? I can guess what you want here, but I'd rather get it explicitly, so that we don't go back and forth with me closing the issue and you reopening it :)
Also, can you reproduce this with other databases like MySQL, or only with MS SQL Server?
It is true the connection is closed. What is it you are looking for? A better error message that doesn't say "Unable to refresh children"? If you look at step 4, you will see following: "4. Connect again, rightclick and choose "Refresh"." So I reconnected and got error after this. And this is a problem. ;) And I also can reproduce this with Java DB, so I think this problem can occur for every DB.
I'll do this. I just bumped into it last night myself.
This happens because the child nodes are handed a copy of the property set from the parent upon creation. Upon reconnect the driver specification property is updated in the ConnectionNodeInfo but that doesn't get reflected in its children. My proposed fix (already tested in my sandbox) is to update the appropriate property in the child nodes when the driver specification is modified. Anyone have any objections to this? BTW, a better model IMO would be to use an inheritance model for properties. Children would only keep properties that are specific to themselves, and would delegate the rest to their parents. I'm not proposing this approach right now, but it might be a useful technique in the future.
It looks like the fix I had proposed (using property inheritance) has been implemented by someone for some other issue. Let me know which issue it was and I'll refer this one to it and close this one. The fix I found this morning is in DatabaseNodeInfo. It now delegates to the parent for properties.
Geez, I remember your proposal going by but at the time it didn't sink in. Sorry about that! Yes, I did this to solve issue 146442, where if a server is restarted or a connection times out, instead of just reporting an exception, now I report a nice dialog and give the user the option to reconnect. The problem was that after reconnect, the DriverSpecification was getting set on the ConnectionNodeInfo, but the child Node Infos were not getting it. Their DriverSpecification property (and other properties) are copied from the parent when the Node Info is initialized but after that the Node Info instance is isolated and does not notice changes to the parent. The DriverSpecification has a reference to DatabaseMetadata which is used for MD calls, and the old DriverSpec was pointing to the old JDBC connection which is now closed. So now when you call getDriverSpecification, you get it from the ConnectionNodeInfo. Same for other similar properties related to connection state. The whole thing is very odd, and hopefully we can resolve this when we look at a rewrite. I'm closing this issue as a duplicate of 146442 *** This issue has been marked as a duplicate of 146442 ***