Skip to Content.
Sympa Menu

freetds - Re: [freetds] TDS just 'died'

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Constantin Vasilyev <vasilyev AT ncbi.nlm.nih.gov>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] TDS just 'died'
  • Date: Tue, 9 Jun 2009 22:46:46 -0400

The error is not related to FreeTDS, but rather to the SQL server itself.
Resetting login's default database to 'master' with this command should fix
the problem:


alter login <loginname> with default_database = 'master'


I assume here that you're running SQL2005 or SQL2008.
For older versions use 'sp_defaultdb' stored procedure.


Constantin


On Tue, Jun 09, 2009 at 10:13:41PM -0400, James K. Lowden wrote:
> 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
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page