Start a new topic

Updating passwords by command-line

I think I've asked this before but can't find it.  I did find a 5-year old thread about adding the ability to change passwords for multiple connections but that doesn't seem to be available.


Is there a way to update passwords by command line?  Or to drop/create a connection from the command line?


I have hundreds of connections and every time I change my password I have to touch every one of them. I need a script for this.  I'm sure there are others who have thousands of connections to manage.


I just did exactly what Dale did on some 150 connections. For me, the multi-connection select was a godsend for picking out the initial connections to change the user and password (I just control-clicked any folders to remove them from the select). Then I easily updated dbvis.xml when my password changed. It may not be perfect but at least you don't have to update each one by hand.


1 person likes this

Great. One more idea is to offer so that you can specify the old password and DbVisualizer will automatically scope all matching database connections in the multi connections edit? 


Regards


Roger


1 person likes this

Dale,


In the DbVisualizer UI select the database connections you want to change the password (or other settings) and then right-click in the Database tab and select Edit Database Connections. That will open window showing all fields that are commonly available for the selected database connections, by database type. Since for example Password is available for all connections you will manage to change that in a single edit for multiple connections.


I hope this is what you are looking for.


Regards


Roger

That doesn't work. 


If you select database connections only it will work.  You can click the first in a list and then shift-click the last in a list, and, if the entire list is all in the same folder then it will work.


The problem is, I think most people who use DbVis would agree, that most people take advantage of the feature that allows us to group our connections into folders.  The shift-click feature will select across multiple folders but it selects the folder item in the tree as well as the connection items in the tree.  I assume because there are multiple object types selected, when you select this way then the "Edit Database Connections..." menu option is disabled.


So, with the options provided, you have to repeat the process for each folder in your tree or you have to manually ctrl-click each connection (perhaps hundreds or thousands) to select the connections across folders without actually selecting the folders.


This is an oft-mentioned gap in the features of DbVis over many years.  There really should be a way to create/delete/update a connection through available APIs.  I'll add a feature request and hope that this gets solved sometime.


In the mean time, the best workaround that actually will work, but still takes manual intervention in the GUI, is this:


  1. Open the GUI. 
  2. Change the password for one connection that uses your user account.
  3. Close the GUI.
  4. Make a backup copy of %userprofile%\.dbvis\config70\dbvis.xml
  5. Open dbvis.xml and edit
  6. Find the entry for the one connection you changed in the GUI
  7. Copy the encrypted and base64'd password value
  8. Now you have a few options depending on how your accounts are created/used.  If all your passwords for your user account are the same, such as all "dale" accounts use my same password, then simply search and replace all of the old password values with the new encrypted value from the one connection you changed.
  9. Alternatively, and I may do this for my team as well, use a regx to find all connections with userid = "dale", move up to parent node,  down to children and find the password node and update password. 
  10. Save the changes, reopen the DbVis GUI.


So once you know the solution is to change one connection so you can get a valid encrypted base64 value for your new password and you can globally find/replace, you have a lot of scripting options on how to apply the replacement password or you might find that, though not ideal (ideal would be an API call) all the scripting is not worth the trouble and just use your favorite text editor's global search/replace function manually)


         



Thanks.


So if we offered an improved way of selecting what connections to multi edit, it would be sufficient?


Regards


Roger

It would be a help but I don't understand the reluctance to just add the APIs.


I already have my connections divided into two main folders, one for those with my account and one for those with service accounts.  Under each are dozens more folders.  If I did a multi-select across folders and it didn't select the folders themselves, or if the app still enabled the edit connections option but was smart enough to just signore the folders when editing connections, that would certainly help.


This is a pretty restrictive solution as it requires a structure similar to what I have, requiring that your folders group connection by user ID rather than by any other functional or business purpose the user might prefer.


For the record, I am not sure that any other SQL tool manages this any better than DbVis but I don't use those tools; I use this one.

Dale,


We are not reluctant to add APIs, I haven't said so either. 


We do have a multi connection edit capability available which is helpful for most users. Adding an API would attract a very small number of users (since it requires coding) while having it in the GUI gives a much easier way to accomplish these tasks. This is the reason I am trying to figure out what you are looking for, in order to hopefully adjust the current functionality to allow the requested functionality. 


So if I understand you correct, you have two top level folders containing a lot of sub folders and database connections? You then want to change the passwords for all database connections for one of the top level folders?


Regards


Roger

Yes, I have two folders.  Changing all connections under the top level folder would work for me.



Since the encryption does not appear to use a random salt, it would be easy to update all those with the same password.  Hopefully people aren't using the same password across multiple accounts because that would break things.


What about asking for account name and password?


Dale,


Thanks. I was just thinking of having that (additional) way to select the database connections in effect. I am as you say quite sure that technique is not very useful for the majority of users.


Regards


Roger



Dale,


Just to inform that we have released a beta version of the upcoming DbVisualizer 11.0 which makes it easier to scope and search for database connection in order to perform multi-edits such as changing passwords.


Would be great to get your feedback on the new version.


Highlights: https://www.dbvis.com/beta/whatsnew/110

Download: https://www.dbvis.com/beta/


Regards


Roger

Dale,


Just to inform you that DbVisualizer 11.0 has been released with a few fixes related to the multi connection editing such as changing passwords. You may either scope what connections to edit by opening the Connections node in the Databases tab or by opening a Folder. It allows filtering, searching, etc to narrow down the exact connections to edit. You find the full release notes and download on our web.

In DbVisualizer open Help->Check for Update to run the upgrade or download from our web site.

Please let me know if I can be of further assistance with any questions you may have.

Regards


Roger

Login or Signup to post a comment