Hi, I am trying to create a form which allowed user to change their password. Logins (username/pwd) will be managed via Oracle ... but I am not sure how to do that. Can anyone help?
.NET
get your oracle connection string OraConn (various methods depending on your environment)
Dim OraCmd As New OracleCommand()
OraCmd.Connection = OraConn
OraCmd.CommandText = "{yourschemaName}.proc_change_password"
OraCmd.CommandType = CommandType.StoredProcedure
OraCmd.ExecuteNonQuery()
OraConn.Close()
Oracle PL/SQL procedure
CREATE OR REPLACE PROCEDURE proc_change_password
AS
begin
execute immediate alter user {user_name} identified by {new_password};
end;
WIth parameters, you can modify the PL/SQL to pass into the procedure the schema name (user name) and the password from .NET
create or replace
PROCEDURE CHANGE_USER_PASSWORD(
USER_NAME_IN IN VARCHAR2 ,
NEW_PASSWORD_IN IN VARCHAR2 )
AS
BEGIN
EXECUTE IMMEDIATE 'ALTER USER '|| USER_NAME_IN ||' IDENTIFIED BY '|| NEW_PASSWORD_IN;
COMMIT;
END CHANGE_USER_PASSWORD;
Above is a oracle procedure for change user password, Here USER_NAME_IN is user logon name and NEW_PASSWORD_IN is new password which you wan to change.
If you want to test this procedure, please run use below code on sql plus.
hbcontract20...
Member
34 Points
187 Posts
Changing Oracle user password using ODP.NET in WinForm?
Aug 23, 2011 04:41 PM|LINK
Hi, I am trying to create a form which allowed user to change their password. Logins (username/pwd) will be managed via Oracle ... but I am not sure how to do that. Can anyone help?
Lannie
Contributor
3742 Points
730 Posts
Re: Changing Oracle user password using ODP.NET in WinForm?
Aug 23, 2011 08:23 PM|LINK
You can call Oracle Procedures from .NET
.NET get your oracle connection string OraConn (various methods depending on your environment) Dim OraCmd As New OracleCommand() OraCmd.Connection = OraConn OraCmd.CommandText = "{yourschemaName}.proc_change_password" OraCmd.CommandType = CommandType.StoredProcedure OraCmd.ExecuteNonQuery() OraConn.Close() Oracle PL/SQL procedure CREATE OR REPLACE PROCEDURE proc_change_password AS begin execute immediate alter user {user_name} identified by {new_password}; end; WIth parameters, you can modify the PL/SQL to pass into the procedure the schema name (user name) and the password from .NETashish.net1
Member
18 Points
10 Posts
Re: Changing Oracle user password using ODP.NET in WinForm?
Nov 28, 2011 10:57 AM|LINK
create or replace PROCEDURE CHANGE_USER_PASSWORD( USER_NAME_IN IN VARCHAR2 , NEW_PASSWORD_IN IN VARCHAR2 ) AS BEGIN EXECUTE IMMEDIATE 'ALTER USER '|| USER_NAME_IN ||' IDENTIFIED BY '|| NEW_PASSWORD_IN; COMMIT; END CHANGE_USER_PASSWORD;