Unanswered: "Data source name not found and no default driver specified" err for VFP ODBC driver
I have to integrate an older COM library with an ASP.NET application. The library loads Fox Pro DBF files into a MSSQL database. The call to the library’s main method results in the following error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified. The library works fine with the old ASP site and also works fine when called from a .Net console application.
I presumed that the error was due to insufficient rights of the ASPNET user account and I tried to impersonate my current user account which is member of the Administrator group (the old ASP application uses Windows Authentication). It didn’t work, neither with impersonation at web.config level, nor with impersonation at page level using the Win 32 LogonUser method.
I tested the library using vbs scripts and the runas command line utility and I got the following results:
1. The piece of code causing the trouble is (the error is thrown when the connection opens):
2. The code works only under my current user account (it does not work even under the Administrator account)
3. The code works fine for any user when I use the /noprofile argument of the runas utility
From that I deduct that the error is not due to missing security permissions, but to the Windows profile of the user under which the code executes (that explains why impersonation doesn’t work). Maybe this has something to do with the fact that the Visual Fox Pro ODBC driver has been discontinued since MDAC version 2.6. I have installed MDAC 2.6 over MDAC 2.8 because the library explicitly required this version. The installation was carried out under my account and maybe the driver seems to be not installed for the other accounts.
I checked the registry key for the ODBC driver (HKLM/Software/ODBC) and the permissions granted on it were fine, so this is not the problem.
Thanks for any advice
Stupid me, because the library documentation said nothing about creating a data source, I presumed the connection string was DSN-less and I didn't even look at it.
The "Visual FoxPro Tables" and "Visual FoxPro Database" DSN's were automatically created, perhaps upon VS 98 installation. I have 2 computers on which they are created as User DSN and one on which are they are created as both user and system DSN's.
I've created identical system DSN's and now everything works.