Change Oracle password through C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am needing to write an application that will be used every month to
automatically run queries on an Oracle database. But the password I need to
log in to the database needs to be changed every month. Is there any way to
change the password through the connection string, or through any other C#
code so I do not have to change it manually every month (since the app is
automated)?
 
...
I am needing to write an application that will be used
every month to automatically run queries on an Oracle
database. But the password I need to log in to the
database needs to be changed every month. Is there any
way to change the password through the connection string,
or through any other C# code so I do not have to change
it manually every month (since the app is automated)?

You can run an OracleCommand.ExecuteNonQuery()
with the statement text

ALTER USER username IDENTIFIED BY newpassword


// Bjorn A
 
If the password is changed outside your control, your app will need to
supply it in the connect string, changing it each month. But if your
application is required to change the password each month, then you will
need a store of passwords to use each month. After each month's execution,
before disconnecting, your app can set the password for the next month using
the "ALTER USER myuser IDENTIFIED BY mynewpassword". Some data providers,
specially those created from Oracle (not Microsoft) have methods to change
the password too (Oracle 8 and higher) using the underlying
OCIPasswordChange() Oracle function. Finally, also you could configure
Oracle 8 (or higher) to set the expiration period for a password (say, 1
month). When your app connect the next time, it will have to supply the old
password and a new password.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top