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 237345 - [Regression] If not selected schema in the database by default, it does not show any
Summary: [Regression] If not selected schema in the database by default, it does not s...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Libor Fischmeistr
URL:
Keywords: PATCH_AVAILABLE
: 238022 238848 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-10-19 08:58 UTC by altermann
Modified: 2013-12-03 13:20 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
In the LocalDB scheme is not selected by default, in Ecocad the selected schema stroytec_ecocad (46.76 KB, image/png)
2013-10-19 08:58 UTC, altermann
Details
Message.log (84.38 KB, text/plain)
2013-10-19 13:02 UTC, altermann
Details
With property connections (124.08 KB, image/png)
2013-10-19 13:03 UTC, altermann
Details
Build of netbeans 7.4 sources for db explorer with proposed patch (1.58 MB, application/x-java)
2013-11-14 20:29 UTC, matthias42
Details

Note You need to log in before you can comment on or make changes to this bug.
Description altermann 2013-10-19 08:58:55 UTC
Created attachment 141291 [details]
In the LocalDB scheme is not selected by default, in Ecocad the selected schema stroytec_ecocad

That no press, the scheme does not show. Created a connection to the specified database schema default was showing.
Comment 1 matthias42 2013-10-19 12:14:44 UTC
Could you please provide more information:

1. What DBMS are the databases LocalDB and Ecocad using (For Ecocad it looks like MySQL (-> the listed databases lead to that conclusion))? 
2. Is there actually a database/tables/schemas in LocalDB?
3. Please provide the message log: http://wiki.netbeans.org/FaqLogMessagesFile

Please ropen this issue if you can add that information.
Comment 2 altermann 2013-10-19 13:01:32 UTC
I hope correctly translate your questions:

1. com.mysql.jdbc.Driver in both connections
2. Yes, these connections to the same server
3. In Attachments
Comment 3 altermann 2013-10-19 13:02:16 UTC
Created attachment 141294 [details]
Message.log
Comment 4 altermann 2013-10-19 13:03:12 UTC
Created attachment 141295 [details]
With property connections
Comment 5 matthias42 2013-10-19 14:14:15 UTC
Thank you! The screenshot of the connection properties was very helpful!

I could reproduce it with an DB Url in the form: "jdbc:mysql://<host>:<port>"

The problem arises, when the default catalog (a synonym for database) can't be determined. In the ecocad connection you specified the catalog to connect to, while the LocalDB connection missed a database to connect to.

I didn't even try such an url, I always specified the mysql database as the default catalog, if I did not know which database I needed. This is also my suggested work around for now.

I'm not sure when I can take a deeper look at this, but as a lead for the netbeans developers:

I tracked it down into the Lookup.Provider implementation org.netbeans.api.db.explorer.node.NodeProvider. In the getNodes method lines (114-122) - if the NodeProvider is marked as proxying another node, the children of the current node are iterated and their child nodes are returned as the children of the current node. This was only implemented for nodes extending BaseNode.

In the last iteration a new concept ("important catalog" and "important schema") was introduced, that uses nodes not extending BaseNode, but AbstractNode. I just gave this a quick test:

--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -118,8 +118,12 @@
                     for (Node n : list) {
                         nodes.add(n);
                     }
+                } else {
+                    for(Node n: child.getChildren().getNodes()) {
+                        nodes.add(n);
                 }
             }
+            }
 
             return Collections.unmodifiableCollection(nodes);

This showed all catalogs as expected.
Comment 6 altermann 2013-10-19 14:43:28 UTC
I have a lot of different schemes on the same server under different projects, and I do not choose the database by default, so you do not accidentally execute sql on the wrong scheme.
Thank you figured out, I hope this will be fixed in the 7.4.1 update in the near and not 7.5.
Comment 7 matthias42 2013-11-14 20:25:21 UTC
*** Bug 238022 has been marked as a duplicate of this bug. ***
Comment 8 matthias42 2013-11-14 20:29:26 UTC
Created attachment 142202 [details]
Build of netbeans 7.4 sources for db explorer with proposed patch

The attached jar is a drop-in replacement for the database explorer module in 7.4. You have to replace the module contained in 7.4 with the attached version. You can find it in the $netbeansHome/ide/modules directory.

I checked the mysql part and it seems to work ok, I would like to ask you to check it also.
Comment 9 matthias42 2013-11-27 17:44:33 UTC
*** Bug 238848 has been marked as a duplicate of this bug. ***
Comment 10 emiddio 2013-11-27 18:38:51 UTC
i tried the patch jar and seems to solve the problems i was having.
Comment 11 matthias42 2013-12-01 15:21:17 UTC
Raising priority to P2:

 usability 	

Prevents users from completing work without significant or inefficient legwork

Users have to change their configuration (for example you'd need to find a schema that exists). If no other SQL editor is present the user needs to find the necessary statements to enumerate schemas/catalogs or needs to install a db specific tool.

Apart from that its a regression to the behaviour in 7.3.
Comment 12 Libor Fischmeistr 2013-12-03 13:20:34 UTC
Patch applied: http://hg.netbeans.org/core-main/rev/ef094f654b27

Thank you very much Matthias.