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 97251 - DatabaseMetaDataHelper passes null for schemas - prevents making a connections using NetBeans APIs
Summary: DatabaseMetaDataHelper passes null for schemas - prevents making a connection...
Status: RESOLVED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 5.x
Hardware: PC All
: P1 blocker (vote)
Assignee: John Baker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-06 05:40 UTC by John Baker
Modified: 2007-04-20 00:42 UTC (History)
0 users

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 John Baker 2007-03-06 05:40:23 UTC
org.netbeans.modules.visualweb.sql.DatabaseMetaDataHelper

passes null schemas to DesignTimeDataSource .

This blocks using DatabaseConnection and from creating a valid connection.

As a result, no matching connection is found in DB Explorer

when debugging, if I try to connect to a Travel connection and hardcode
"TRAVEL" for the schema, then I can make a connection and DnD of tables from the
TRAVEL schema works.

e.g. 
        DatabaseConnection dbConn = 
DatabaseConnection.create(JDBCDriverManager.getDefault().getDrivers(getDriverClassName())[0],
getUrl(), username, "TRAVEL", password, true);  
          
        Connection conn = dbConn.getJDBCConnection();
Comment 1 John Baker 2007-03-06 06:14:56 UTC
I may have a workaround - instead should use
ConnectionManager.getDefault.getConnections() to get the DatabaseConnections
then compare URLs of connections to the URL of the data source
Comment 2 John Baker 2007-03-06 06:18:05 UTC
This code solves this, but may cause performance problems if there are many
connections ?

        DatabaseConnection[] dbConns =
ConnectionManager.getDefault().getConnections();
        String url = getUrl();
        DatabaseConnection dbConn = null;

        for (int i=0; i<dbConns.length; i++)
            if (url.equals(dbConns[i].getDatabaseURL())) {
                dbConn = dbConns[i];
                break;
             }
 
        return dbConn.getJDBCConnection();

Comment 3 John Baker 2007-03-06 08:24:16 UTC
currently in visualweb, the schema is not considered for a database table
dropped on a page.  This needs to be fixed.

Also the schema needs to be compared with the schema of a DatabaseConnection
since there can be multiple schemas per connection
Comment 4 John Baker 2007-03-30 03:01:43 UTC
Fix is available, but cannot integrate because build is red
Comment 5 John Baker 2007-04-20 00:42:29 UTC
this was fixed in M9