Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot open Visual Fox Pro database

Status
Not open for further replies.

at81

Programmer
Oct 21, 2009
2
0
0
RO
Hello,
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):
Dim sConnString
sConnString = "DSN=Visual FoxPro Tables;" & _
"SourceDB=C:\Temp;" & _
"SourceType=DBF;" & _
"Database=DBFTestFile;"
Set oConnDBF = CreateObject("ADODB.Connection")
oConnDBF.Open sConnString
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.

Thanks for any advice
 
Problem solved,

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top