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.

Bug 143652 - org.netbeans.api.db.explorer.DatabaseException: org.netbeans.api.db.explorer.DatabaseException: unable to connect to server
Summary: org.netbeans.api.db.explorer.DatabaseException: org.netbeans.api.db.explorer....
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: David Vancouvering
URL: http://statistics.netbeans.org/except...
Keywords:
: 144848 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-12 18:45 UTC by Roman Mostyka
Modified: 2008-09-11 13:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 89958


Attachments
stacktrace (7.40 KB, text/plain)
2008-08-12 18:45 UTC, Roman Mostyka
Details
stacktrace (2.24 KB, text/plain)
2008-08-17 20:57 UTC, sunbiz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Mostyka 2008-08-12 18:45:26 UTC
Build: NetBeans IDE Dev (Build 080812)
VM: Java HotSpot(TM) Client VM, 11.0-b13, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b26
OS: Windows XP, 5.1, x86

User Comments: 
1. Add MySQL server.
2. Connect to some DB.
3. Execute following statement: create schema sample
4. Refresh MySQL server node and connect to 'sample' DB.

Result: DatabaseException arises.

Stacktrace: 
org.netbeans.api.db.explorer.DatabaseException: org.netbeans.api.db.explorer.DatabaseException: unable to connect to server
        at org.netbeans.modules.db.explorer.infos.RootNodeInfo.initChildren(RootNodeInfo.java:170)
        at org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo.getChildren(DatabaseNodeInfo.java:697)
        at org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo.refreshChildren(DatabaseNodeInfo.java:357)
        at org.netbeans.modules.db.explorer.infos.RootNodeInfo.refreshChildren(RootNodeInfo.java:305)
        at org.netbeans.modules.db.explorer.infos.RootNodeInfo.stateChanged(RootNodeInfo.java:297)
        at org.netbeans.modules.db.explorer.infos.RootNodeInfo$1.connectionsChanged(RootNodeInfo.java:103)
Comment 1 Roman Mostyka 2008-08-12 18:45:40 UTC
Created attachment 67160 [details]
stacktrace
Comment 2 David Vancouvering 2008-08-12 18:59:11 UTC
Works for me.  Can you reproduce this consistently?
Comment 3 John Baker 2008-08-12 21:46:19 UTC
I can't reproduce this either.

In step 4, does the "New Database Connection" dialog open ?

One thing that doesn't look right though, is after connecting, the context menu for the connected database still
contains the "Connect" menuitem, instead of disconnect
If I try to connect again nothing happens and no exception occurs.

To let a user know that the database is connected, it would be nice if the icon had some indicator like a green flag or
something.
Comment 4 Andrei Badea 2008-08-13 10:12:51 UTC
It seems your build does not have changeset #bf2116ba0897 (see issue 142788 desc5). Please attach the stack trace in a
build that does.
Comment 5 Andrei Badea 2008-08-13 10:15:56 UTC
Whoops, sorry, you do have the changeset. I was mistaken by the short stack trace in the initial description.
Comment 6 Roman Mostyka 2008-08-13 11:44:03 UTC
OK, I investigated this issue more and found new steps to reproduce.
1. Add MySQL server.
2. Connect to some DB (for example "test").
3. Execute following statement: 'create schema sample;'.
4. Disconnect from "test".
5. Refresh MySQL server node and connect to 'sample' DB.

Result: DatabaseException arises.

John, in step 4, the "New Database Connection" dialog is opened. And after connecting in step 5, the context menu for
the connected database still contains the "Connect" menuitem, because it is different connection than in step 2.
Comment 7 David Vancouvering 2008-08-14 00:16:10 UTC
Reproduced.  However, the connection actually *is* connected - it's a timing bug - and the connection works just fine. 

So this is a transient error, and the workaround is quite simple - just go ahead and use the connection.

So I believe this is a P3.  Or is any exception like this automatically a P2?
Comment 8 sunbiz 2008-08-17 20:57:45 UTC
Build: NetBeans IDE 6.5 Beta (Build 200808111757)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b28
OS: Windows Vista, 6.0, x86

User Comments: 
After a connection has failed once.. no other queries work again. Have to disconnect and connect the connection again. Any new operation after an error has occured results in this exception

Stacktrace: 
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:


** BEGIN NESTED EXCEPTION ** 

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
MESSAGE: Communications link failure

Last packet sent to the server was 1 ms ago.

STACKTRACE:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 1 ms ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeConstructorAccessorImpl.java:0)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.Util.getInstance(Util.java:381)
Comment 9 sunbiz 2008-08-17 20:57:51 UTC
Created attachment 67652 [details]
stacktrace
Comment 10 David Vancouvering 2008-08-18 21:19:14 UTC
sunbiz: I think what you're describing is a different issue from this one?  Why do you believe it's the same issue?  If
you agree it's different, please do log a new issue, what you're describing sounds pretty serious.
Comment 11 Roman Mostyka 2008-08-26 14:17:16 UTC
*** Issue 144848 has been marked as a duplicate of this issue. ***
Comment 12 Exceptions Reporter 2008-08-28 18:49:30 UTC
This issue has already 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=89958
Comment 13 David Vancouvering 2008-09-05 19:41:01 UTC
fixed
Comment 14 Roman Mostyka 2008-09-11 13:45:33 UTC
Verified with build 080910.