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 129502 - showConnectionDialog pops up for password even if its told to remember password
Summary: showConnectionDialog pops up for password even if its told to remember password
Status: RESOLVED WORKSFORME
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: David Vancouvering
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-07 07:33 UTC by Vadiraj Deshpande
Modified: 2008-03-24 22:44 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 Vadiraj Deshpande 2008-03-07 07:33:38 UTC
Here is the code to reproduce :

final DatabaseConnection dbConnection = DatabaseConnection.create(drivers[0], driverURL, username, null, password, true);
            ConnectionManager.getDefault().addConnection(dbConnection);
            if(dbConnection.getJDBCConnection() == null ) {
                return Mutex.EVENT.readAccess(new Mutex.Action<DatabaseConnection>() {

                    public DatabaseConnection run() {
                        ConnectionManager.getDefault().showConnectionDialog(dbConnection);
                        return dbConnection;
                    }
                });
                
            }

This problem goes away when the connection is opened from the services tab and told to remember password..
Comment 1 David Vancouvering 2008-03-24 22:17:29 UTC
Reproduced.
Comment 2 David Vancouvering 2008-03-24 22:44:41 UTC
Hi, Vadiraj.  Here's what I'm seeing.  Two connections are considered equal if they both have the same driver, url and
user.  If you try to add a connection to the explorer, and an equal one already exists, the code quietly ignores this
attempt to add a duplicate connection.

Then, when you try to connect, since the existing connection didn't have the savePassword flag set, you get the dialog.

If, however, the connection doesn't already exist, then the new one gets added with the save password flag, and then
when you connect no dialog is raised.

The problem is, you can't set the properties of an existing connection.  

So you'll need to
* Look for existing connection, and if it exists, remove it
* Create the new connection as you see fit

I can see a feature request for being able to change the properties of an existing connection, but that's going to
require some thought as it has to handle what to do if the connection is currently connected.

If this is *not* what you are seeing, if you get this even if there is no existing connection, please re-open -- I was
not able to reproduce under that scenario.

David