password expired ado and vb6

Connectivity
N/A

password expired ado and vb6

My question is...if the psw expire, is possible to renew via vb6 code? the connection string is:




....

Set CON = New ADODB.Connection

CON.ConnectionString = "PROVIDER=MSDASQL;" & _

"DRIVER={Teradata};" & _

"DBCName=10.xxx.x.xxx;" & _

"DefaultDatabase=DFC;" & _

"UID=oixxxx;" & _

"PWD=Nove.2015;"

CON.Open

....

5 REPLIES
Teradata Employee

Re: password expired ado and vb6

After a 3032 warning, you should be connected but the only valid statement would be: MODIFY USER oixxxx AS PASSWORD=newpassword;

Or you can close the connection, append PWD2=newpassword to the connection string, and Open the connection. Then the driver will issue the MODIFY for you.

N/A

Re: password expired ado and vb6

hi Fred!

but in:

ODBC Driver for Teradata User Guide

i see:

Note: PWD2 does not work with SQLConnect because the ConnectStringInput string is not supported and a password expired error will be returned. For applications such as Visual Basic and others that normally cache their connection information, PWD2 might not work. In addition, PWD2 does not work when passwords are stored in the Registry. Caution: For PWD2 to work, an application must be aware of how password expiration is handled by the Teradata session connection process and must use that knowledge when sending connection requests. For PWD2 to work, an application must be aware of how password expiration is handled by the Teradata session connection process and must use that knowledge when sending connection requests. Off-the-shelf ODBC applications or 3rd party tools cannot use PWD2 because their connection code does not know how to use the secondary password. PWD2 only works in applications that have been customized to use it.

Teradata Employee

Re: password expired ado and vb6

Good point. Simply closing the connection object isn't enough. The original session would have to be logged off, which is hard to ensure if you are using Resource Pooling or Session Pooling (and pooling is generally enabled by default). PWD2 only works if supplied when opening a new, "first" session to the database for that user. If a session that received the 3032 warning is still connected (e.g. due to Resource Pooling or Session Pooling), subsequent open attempts receive a 3032 error.

So best option is for the session that receives the warning to execute the MODIFY statement, then close the connection and open a connection using the new credentials.

N/A

Re: password expired ado and vb6

tks Fred.

Example with my initial connection?

Teradata Employee

Re: password expired ado and vb6

You would need to detect the SQLSTATE T3032 / native 3032 warning and execute the MODIFY USER statement using the initial connection. Then you could either continue to use the connection or close it. Any subsequent connections should use the new password.

Note that this assumes that all sessions had been idle for some time so had actually been logged off, so this request is for the first / only session. If the reason that a new session is logging on is that all the sessions in the session pool are still in use (with the old credentials) and you now need an additional session, then it won't work.