in reply to Re: How to change expired database password via DBI?
in thread How to change expired database password via DBI?

Are you sure Toad is using the ODBC Driver?

No, I am not sure. It is probably talking directly to the server via the SQL Server port. Unfortunately, there is no DBD::SQLServer, just DBD::ODBC.

The rest of your post sounds interesting, but I have to admit it's way over my head. :-(

  • Comment on Re^2: How to change expired database password via DBI?

Replies are listed 'Best First'.
Re^3: How to change expired database password via DBI?
by mje (Curate) on Aug 20, 2009 at 07:28 UTC

    It does not really matter how Toad is connecting to SQL Server, I only asked because you said you were using DBD::ODBC and were comparing Toad and ODBC. The point is that the SQL Server ODBC Driver has access to the main window in a MS windows environment and can therefore throw a dialogue up (probably the one you are seeing). The ODBC specification has an API called SQLDriverConnect that is used to connect to an ODBC Driver and it is that API that DBD::ODBC uses. The second argument to that API is a window handle and the last argument can be SQL_DRIVER_PROMPT which allows the driver to throw up a dialogue if it needs to. DBD::ODBC does not have a window handle as it is not a GUI application but an interface (and currently there is no way to pass one to it) so as a result it does not bother using the SQL_DRIVER_PROMPT argument to SQLDriverConnect and this prevents the SQL Server driver from throwing a dialogue. Toad on the other hand is a GUI app so IF it was using the SQL Server ODBC Driver (and the same probably applies to JDBC) it can pass a window handle to the driver and hence it can pop up a dialogue if it needs to.

      Okay, I understand. And looking through the C code for DBD::ODBC, I see where SqlDriverConnect is being called, and that it uses SQL_DRIVER_NOPROMPT.

      So it appears that there is no way to do what I want in Perl. Rats.

        No, I did not say there was no way to do it. I was just explaining the current mechanism and where your dialogue was probably coming from. We can change DBD::ODBC in a few ways to perhaps support what you need. I'm not sure where you are going to get a window handle from but there is the connection attribute SQL_COPT_SS_OLDPWD which I could look at. In fact, by sheer coincidence (not), I've had a request for this in my email this afternoon - not doubt from someone else in your operation.

        Unfortunately, I am away on holiday for 2 weeks from tomorrow so I won't be able to do anything about it but DBD::ODBC is in subversion and I'd happily accept a patch. Otherwise, you'll have to wait 2 weeks and remind me then.