unable to change expired password through ODBC connection in ASP web page using VB

Connectivity

unable to change expired password through ODBC connection in ASP web page using VB

Hello. I have an inward facing ASP web app that I am changing to connect to Teradata instead of an AIX box.  I am able to connect to the Teradata Server and execute queries using an ODBC connection using VB 6 (so I'm told. I don't really know a lot about VB).  This requires the user to enter a user id and password in the web app to log on to the Teradata DB.  This works just fine.  The problem comes when the password expires (every 30 days).

I've been able to keep the app from freezing by using the Teradata ODBC drivers (instead of the generic ODBC drivers) and using the QUIETMODE=YES in my connection string.  I saw a forum post that referenced using PWD2 in the connection string, with the idea that if the password was expired, the system would change the password to the value of PWD2.  Here is the basics of my connection code: (The quotes and "& strCRLF & _" are due to the fact that this resides in an ASP page) 

Set Testdb = Server.CreateObject("ADODB.Connection")

   ConnStr = "Driver={Teradata};"                                                    & strCRLF & _

       "DBCName=11.11.11.51 (dwcop1),"                                          & strCRLF & _

          " 11.11.11.52 (dwcop2),"                                                        & strCRLF & _

     " 11.11.11.53 (dwcop3),"                                                             & strCRLF & _

     " 11.11.11.54 (dwcop4),"                                                             & strCRLF & _

     " 11.11.11.55 (dwcop5),"                                                             & strCRLF & _

     " 11.11.11.56 (dwcop6),"                                                             & strCRLF & _

     " 11.11.11.57 (dwcop7),"                                                             & strCRLF & _

     " 11.11.11.58 (dwcop8);"                                                             & strCRLF & _

     "UID=Testuser;PWD=Testpwd1;PWD2=Testpwd1;"                     & strCRLF & _

     "QUIETMODE=YES;"  

Testdb.Open(ConnStr)

but if I check the connection state (Testdb.State) right after this, it's a 0 (closed), and I get the "[NCR][ODBC Teradata Driver][Teradata Database] User password has expired." message (passed back in both the err.description and the Testdb.errors(0))

Thinking that the change password might have closed the connection, I hard-coded a connection after this to use the new password, which gives me a "Invalid password" message.  If I hard code the second connection to use the original password, I again get the "User password is expired" message.

Any help would be greatly appreciated.  I am not coding the VB or ASP's using any kind of slick software...just notepad.

2 REPLIES

Re: unable to change expired password through ODBC connection in ASP web page using VB

I found the problem!

The "& strCRLF" is adding a "carraige return and line feed" to the string.  Once I took that out, the password got changed. 

One warning for those using this though. I does close the connection.  So what I did, was the first time I don't pass PWD2, and so I get the "User password is expired" message.  I use this to force a form with the familiar, "user id, old password, new password, confirm new password" and I use these to build a second connection, passing PWD and PWD2, then, if no errors, call the open connection a third time, passing the new password as PWD.

Re: unable to change expired password through ODBC connection in ASP web page using VB

I lied. It didn't close the connection the second time. That was my fault in how the logic flowed.  Once you pass PWD and PWD2 it will change your password and log you on.  Happy Querying!