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 212916 - 108422 is still an issue for me
Summary: 108422 is still an issue for me
Status: RESOLVED INVALID
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.2
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords:
Depends on: 108422
Blocks:
  Show dependency tree
 
Reported: 2012-05-23 20:05 UTC by jlangton
Modified: 2012-08-20 16:18 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 jlangton 2012-05-23 20:05:42 UTC
I have this same error on 7.0.1 and 7.2

We have  NetBeans RCP. We use Database Explorer and the ConnectionManager to connect to the database. The bug is really the exact same as the one referenced: 108422

Even if we keep the IDE session open, each time we press run, the application always asks for a password to make a database connection. This is despite the fact that the code I'm using to create that connection in the first place sets it to remember the password, exactly as described in this bug. 

Any help is really really really appreciated because I'm about to just throw the password into the user preferences as a work around which is completely insecure (I'm hoping the remembered one through your API is secure).

John
Comment 1 Jesse Glick 2012-05-24 02:58:11 UTC
Current DB code should be using the Keyring API to securely persist passwords.
Comment 2 Jaroslav Havlin 2012-05-24 12:41:55 UTC
I cannot reproduce on 7.2 (Windows 7), the remembered password is used as expected.
Can you please attach some example code that demonstrates the problem? Thank you.
Comment 3 Jaroslav Havlin 2012-05-28 08:51:07 UTC
Closing. Please reopen if you can provide us with more information, preferably some example code.
Comment 4 jlangton 2012-08-14 15:36:31 UTC
Terribly sorry for the delay in responding to my own thread.

To be clear - the issue is that the password is not remembered between application runs. Meaning, if I run the app, save password, close app, run app, then it asks for the password again. I'm assuming that remember password is supposed to span that. Is that correct?

My code is literally: databaseConnection = SelectConnectionDialog.showDialog();

I have a singleton. When something wants a DatabaseConnection object, it calls out to the singleton. If the connection is null in the singleton, it creates a new one by calling:
databaseConnection = SelectConnectionDialog.showDialog();

That call launches the DatabaseExplorer GUI that has an option "remember password". However, even if I check that, every time I run that app, it always requires the password. It will actually remember previous connections, and enable me to select from them, but for whatever reason, it will never remember the password. 

Am I missing something? I can try to include more code, but I don't think it's directly related.
Comment 5 matthias42 2012-08-18 20:34:47 UTC
Hey, I looked through the code which is responsible for saving a database connection. This code delegates to the keyring api to save the password:

Starting point:

/db/src/org/netbeans/modules/db/explorer/DatabaseConnectionConvertor.java (line 401, Method write)

Leeds to:

/db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java (line 622, Method storePassword)

Leeds to:

/keyring/src/org/netbeans/api/keyring/Keyring.java (line 184,  Method save)

Leeds to:

/keyring/src/org/netbeans/api/keyring/Keyring.java (line 155,  Method saveImpl)

Leeds to:

/keyring/src/org/netbeans/api/keyring/Keyring.java (line 96, Method provider)

I think there is your problem - If no "real" keyring provider can be found, the "DummyKeyringProvider" (see line 217 in Keyring.java) is instanziated, which only works till the program is shut down (not persistency).

So check whether you include a real keyring implementation into your application (see module keyring.impl ( Keyring Implementations ))
Comment 6 jlangton 2012-08-20 16:18:38 UTC
Thanks! That was it. 

I missed it as there is no dependency between DatabaseExplorer module and the keyring modules. Not sure if there should be such a dependency?  I guess I'll set this to resolved and invalid.

thanks, 
John