ODBC error calling executable from a stored procedure

  • Hello,

    I have an executable created with VB.Net that opens an Access database and executes some queries. It is located on the database server and works perfectly if I run it from a command prompt (on the server).

    However... if I call this executable from a SQL Server 2008 stored procedure, it runs correctly until it reaches a point where it has to open a query involving ODBC tables in that specific MSAccess database.

    Then, it returns: "ODBC--connection to 'myDSN' failed."

    Note: 'myDSN' is an ODBC data source created on the same server and is used by MSAccess tables. It works fine, no problem if I open Access database tables directly.

    T-SQL code in stored procedure:

    exec master..xp_cmdshell '"E:\Access_Update.exe"';

    Please advise.

    Regards,

    M.R.

  • Did you make the dsn a "system" dsn, ie., available to everybody (including the account that will be used to fire off xp_cmdshell)?

    Is the underlying access file also available to the account that xp_cmdshell will run under?

  • THANK YOU VERY MUCH patrickmcginnis59 for your suggestion, I created a System DSN (rather than an User DSN) and it worked!

    Regards,

    M.R.

  • Awesome! Glad you got it working!

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

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