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.
There are 2 scenarios that result in Catalog instances with null names. The first is on a MySQL connection where no database is specified. In this case when the list of catalogs is retrieved from the meta data, there is an extra catalog with a null name. The second is on a Derby connection. The default catalog has a null name. I believe it should have the same name as the default schema.
I think the extra catalog with a null name should be fixed. I don't think there's much we can do about Derby - I can investigate, but I'd like to track this as a separate issue. I don't think the right solution is for the catalog name to be the same as the schema name, as I believe this is inaccurate and misleading. For example, today we have the "sample" database with the default schema as "APP". Following your approach, the catalog name would be "APP" too - that doesn't seem right. Note that the default schema for a user XXX in Derby is the schema XXX. So you would have a different catalog name for each user. I think Derby should be providing the database name rather than null, so I'm going to report a bug and will provide a link to it here. That said, if the underlying DB returns null for a catalog name, I think the API should return 'null', as that is the most accurate thing to do. How that is handled depends upon the user of the API. A Java application would probably want to know it is 'null' and not get some substituted value. In the case of the DB Explorer, you need to decide how to represent a null catalog that makes sense for your context. Maybe the string "<none>" or "<UNNAMED-CATALOG>"
You're right. Using the default schema name in the Derby case is not right. I don't think the catalog name should be null, so maybe it is as you suggest a Derby bug. Since we specify a database when making a connection to a derby database, the catalog should have a name. As a stopgap, there may be a way to look at the connection to get the database name.
> As a stopgap, there may be a way to look at the connection to get the database name. Yeah, maybe I could do that in the MD API, let me look into that...
Changing the issue title to be specific to the MySQL problem. I made the Java DB problem a separate issue.
4c9110df4324 and 1437e607b9d8
Fixed, will be integrated after stabilization, as it is fixed on top of a lot of enhancements.
Verified.
Integrated into 'main-golden', will be available in build *200812221122* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/4c9110df4324 User: David Van Couvering <davidvc@netbeans.org> Log: #154407: When you connect to MySQL without specifying a DB, you get a catalog with a null name