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 154407 - When you connect to MySQL without specifying a DB, you get a catalog with a null name
Summary: When you connect to MySQL without specifying a DB, you get a catalog with a n...
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: DB schema (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: David Vancouvering
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-02 23:32 UTC by Rob Englander
Modified: 2009-02-19 20:38 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Englander 2008-12-02 23:32:08 UTC
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.
Comment 1 David Vancouvering 2008-12-03 17:43:53 UTC
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>"
Comment 2 Rob Englander 2008-12-03 18:10:58 UTC
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.
Comment 3 David Vancouvering 2008-12-03 22:17:06 UTC
> 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...
Comment 4 David Vancouvering 2008-12-04 18:38:01 UTC
Changing the issue title to be specific to the MySQL problem.  I made the Java DB problem a separate issue.
Comment 5 David Vancouvering 2008-12-05 19:41:41 UTC
4c9110df4324 and 1437e607b9d8
Comment 6 David Vancouvering 2008-12-05 20:57:49 UTC
Fixed, will be integrated after stabilization, as it is fixed on top of a lot of enhancements.  
Comment 7 Roman Mostyka 2008-12-18 16:24:33 UTC
Verified.
Comment 8 Quality Engineering 2008-12-22 15:26:05 UTC
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