[freetds] TDS just 'died'

James K. Lowden jklowden at freetds.org
Tue Jun 9 22:13:41 EDT 2009


O'Neil, Donald A. wrote:
> Our DB admin detached the DB from the MSSQL server, ran a backup and the
> re-attached the DB, and ever since he did that we're getting errors on
> our FreeTDS scripts:
...
> Cannot open user default database
...
> Login failed for user 'NOCReader'
...
> Anyone have any ideas as to what could have happened on the SQL side of
> things to break this?

No idea, except that it's a server issue, because those messages came from
the server.  

Logins are defined by the server, not a database.  However, that "cannot
open user default database" message says the user is no longer defined or
allowed in the database.  

If the 'change to initial database must succeed' flag is set in the login
packet (cf. http://www.freetds.org/tds.html#login7) the server will
disconnect if the database is unavailable to the user.  

And it is set on:

$ grep -n option_flag1 src/tds/login.c
702:    unsigned char option_flag1 = 0x00;
797:    option_flag1 |= 0x80;   /* enable warning messages if SET LANGUAGE
issued   */
798:    option_flag1 |= 0x40;   /* change to initial database must succeed
         */
799:    option_flag1 |= 0x20;   /* enable warning messages if USE
<database> issued */
801:    tds_put_byte(tds, option_flag1);


HTH.  

--jkl



More information about the FreeTDS mailing list