Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Location
    Australia
    Posts
    26

    Arrow Unanswered: DSN goes to wrong database

    Hello!

    I set up a system DSN but it connects to the wrong database. I have set the default database correctly but it seems to ignore it.

    If i switch to the correct BD like this: "USE myDB SELECT * FROM myTable" then it works fine.

    Am i missing something?

    this is my connection string [in my ASP page]:

    "Driver={SQL Server};" &_
    "Server=myServer;" &_
    "DSN=myDSN;" &_
    "UID=myUserName;" &_
    "PWD=myPWD;"


    Thanks!

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    What database is it defaulting to ?

  3. #3
    Join Date
    Nov 2002
    Posts
    9

    Connect string is confused

    Looks like you're mixing up the ODBC connect string data. Use one of these formats

    To use the System DSN you created use
    "Driver={SQL Server};" &_
    "DSN=myDSN;" &_
    "UID=myUserName;" &_
    "PWD=myPWD;"
    (may or maynot work)

    To use a DSNless connection use
    "Driver={SQL Server};" &_
    "Database=myDB;" &_
    "UID=myUserName;" &_
    "PWD=myPWD;"
    (Should work, but haven't tested)

    I'm thinking it's probably trying to use the user's default database set up in SQL Server. Your alternative would be to go into use manager and change the default db (or tell your DBA to do it).

    Originally posted by rnealejr
    What database is it defaulting to ?

  4. #4
    Join Date
    May 2002
    Location
    Australia
    Posts
    26
    yeah i think it has something to do with the particular user. a different username and password will change the default database.

    i'll try that connection string. thank you!

    the problem is i am the DBA at the moment. the ususal guy is away for awhile.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •