Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

ChangePassword (OraSession) Method

Applies To

OraSession

Description

This method changes the password for a given user.

Arguments
Description
[in] database_name
A string representing the Oracle Network specifier used when connecting to a database.
[in] user_name
A string representing the user for whom the password will be changed.
[in] current_password
A string representing the current password for the user.
[in] new_password
A string representing the new password the user account will be set to.
Usage

OraSession.ChangePassword database_name, user_name, current_password, new_password

Remarks

This method is especially useful when a password has expired. In that case, OpenDatabase or CreateDatabasePool could return the error:

ORA-28001 "the password has expired".

Example

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim password as String

'Note: The DBA could expire scott's password by issuing

'ALTER USER SCOTT PASSWORD EXPIRE

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

password = "tiger"

On Error GoTo err:

Set OraDatabase = OraSession.OpenDatabase("ExampleDb",

"scott/" & password, 0&)

End

err:

'Check for password expiration error

If OraSession.LastServerErr = 28001 Then

OraSession.ChangePassword "ExampleDb", "scott", password, "newpass"

'reset our password variable, then try OpenDatabase again

password = "newpass"

Resume

End If

End


 
Oracle
Copyright © 1994, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback