Tuesday, January 31, 2017

Utility to change password for multiple databases

Begin with story what motivated me to create the utility:

As people may have multiple databases in their environments its difficult to remember passwords every database as they expire certain days (may be not be true in your case). One of my client asked  is there way to create a utility to change passwords all at once with same password for all dbs.

As I reviewed my options, MS-DOS the little tool which I learned at school. Quickly started developing using DOS and it came out pretty good. below is the snapshot


(sorry had to mask some places). as shown above Welcome {username} automatically gets from machine name. (in our case system user name and db name are same). Once database selected it will ask for current user name and new password. Once its login successful, it will go ahead and change the password (using alter user..).

This utility depends on Oracle client(sqlplus.exe) and system without Oracle client will not be able to use this.

So I've decide to use something else (like Javascript,nodeJs,xojo..etc) nothing really worked out.

Hmm why don't I use java using JDBC.. ? (I knew Java well enough) ok.. using Swings ..? nope dont want to spend too much time on this. JavaFX.........................Yessssssssssssss..

Quickly gone through the API (couple of hours) and started developing next day.. woohoo the output on the same day...

  Highlights:
                  It uses Oracle JDBC library. platform independent.
                  No need Oracle client to be installed on machine (like mine).
                  Can be modified easily to environment specific needs.
                  Database name configured using .properties file.

Structure of Project:

                        Oracle Utility
                              --Lib
                                     ojdbc8.jar
                              --dbname.properties
                              --OracleUtility.jar




dbnames.properties file



:-)