Extended Stored Procedure with ODBC DSN

  • I have an extended stored procedure that makes its own connection via ODBC and performs some processing - stuff that can't be done using T-SQL alone (because it uses some of my other DLLs).

    If I try to connect using the System DSN that is already set up on the PC (e.g. named MyDataSource), the xp returns the following error:

    [Microsoft][ODBC SQL Server Driver][SQL Server] Cannot open database requested in login 'MyDataSource'. Login fails.

    However, if I connect using a connection string (SERVER=MyServerName;DATABASE=MyDatabaseName;etc) then it connects & the xp works.

    I tested the code outside of an xp, just a Windows app, and the connection using the DSN worked. I'd expect this as it is the same way I have connected to a database for 10 years!

    Why it doesn't work using a DSN. I also tried with a user DSN but no difference.

    If I run the command:

    exec master..xp_enumdsn

    then my DSN is listed!

    Any ideas? Thanks.

  • Using ODS, I can get the name of the user, password and the server but not the database. If I could get all of those I'd be able to connect using a connection string.

  • No help at all?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply