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.
Summary: | No way to acquire a JDBC connection without the user being prompted for a password | ||
---|---|---|---|
Product: | db | Reporter: | giorgio42 <giorgio42> |
Component: | Code | Assignee: | John Baker <jbaker> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | Keywords: | API |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | Windows XP | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | 100716 | ||
Bug Blocks: | 212916 |
Description
giorgio42
2007-06-28 15:25:13 UTC
Georg, I tried and this works for me. The following code: JDBCDriver mysqlDriver = null; for (JDBCDriver driver : JDBCDriverManager.getDefault().getDrivers()) { if (driver.getDisplayName().toLowerCase().contains("mysql")) { mysqlDriver = driver; break; } } DatabaseConnection conn = DatabaseConnection.create(mysqlDriver, "jdbc:mysql://localhost/test", "test", null, "test", true); try { ConnectionManager.getDefault().addConnection(conn); } catch (DatabaseException databaseException) { return; } ConnectionManager.getDefault().showConnectionDialog(conn); doesn't ask for the password, it just displays a "Connect" progress window. Is the "Remeber password" property set to true in the properties of the new connection? I'll investigate this more. I had experienced the same behavior as the submitter but I moved on to more important tasks I may be able to get to this by beta1 but will mark for beta2 just in case I don't complete for beta1 In DB Explorer UI, opening the property sheet of a connection, the "rememberPassword" property for a database connection is checked (enabled). This should signify a true value and the password should be remembered. While debugging DatabaseConnection, showConnectionDialog() on line 750, the method findConnectionNodeInfo(getName()) returns a ConnectionNodeInfo. Some property, rememberpwd of ConnectionNodeInfo is set to "false" on line 750 I think it should be set to true. If related, there is an inherited property, passwordWasSet and this too is set to "false" As a result, everytime I invoke ConnectionManager.getDefault().showConnectionDialog(conn); The connection dialog opens prompting me for a password Something doesn't seem right. I removed passwordWasSet, it seemed unused. I'm still not sure wheter you call showConnectionDialog() *in the same session* that you registered it in. Do you? From reporter by private e-mail: The request behind this bug report is to provide the possibility to connect to databases based on the db explorer API "anywhere and anytime" without a database connection dialog appearing, therefore completely independent from any "sessions". Then it is a duplicate of issue 87600 after all. Georg, sorry for the mess. I thought you got the connection dialog even if connecting in the same session that you created the connection in. That should not happen. But you currently always get the dialog when connecting (at least for the first time) in another IDE session (i.e., after a restart). Sorry, but this is not a defect. There was never a plan to support connecting '"anywhere and anytime" without a database connection dialog appearing'. I would have been a defect if you got the Connect dialog in the same IDE session that you created the connection (specifying its password). But I understand that is not the case. I agree it would be good to support this though. John, do you really plan to work on this for beta 2? From the example in desc2, the remember password is set to true, but the connection created has a remember password property that is set to false (based on the property sheet for the connection created) I'll look into this tomorrow JDBCDriver mysqlDriver = null; for (JDBCDriver driver : JDBCDriverManager.getDefault().getDrivers()) { if (driver.getDisplayName().toLowerCase().contains("mysql")) { mysqlDriver = driver; break; } } DatabaseConnection conn = DatabaseConnection.create(mysqlDriver, "jdbc:mysql://localhost/test", "test", null, "test", true); Georg, the part that interests you has been fixed. The DB Explorer now stores the password between sessions. If you can still reproduce the Connect dialog popping up when it shouldn't have, please file an issue. John, do you plan to do anything more in this issue? If not, can you please close it? A big Thank You! to all that have been involved. It seems this caused a lot more work than I would have anticipated. Currently I am under heavy load from my day job, but I will try out the new feature as soon as possible. Best regards, Georg Hi, Georg. I think this is fixed, can you verify? |