[egenix-users] Difficulty connecting

John Corry john.corry at ntlworld.com
Sun Apr 16 11:39:14 CEST 2006


Charlie,

Thanks for the help.  I am now up and running.

Regards,

John.

-----Original Message-----
From: Charlie Clark [mailto:charlie at egenix.com]
Sent: 16 April 2006 09:55
To: john.corry at ntlworld.com
Cc: egenix-users at egenix.com
Subject: Re: [egenix-users] Difficulty connecting


John CORRY wrote:
> Hi,
>  
> I am very new to python and programming.  I am using windows xp, python
> 2.4 and I am trying to log onto a visual foxpro database file.  I have
> downloaded the visual foxpro driver.  I use the following code:
>  
> import mx.ODBC
> import mx.ODBC.Windows
> db = mx.ODBC.Windows.DriverConnect('dsn=c:/test/m2m/data/cost_grid.dbf')
> c = db.cursor()
>  
> and I get the following error:
>  
> Traceback (most recent call last):
>   File "C:\Python24\Lib\site-packages\databasemanager.py", line 4, in ?
>     db =
> mx.ODBC.Windows.DriverConnect('dsn=c:/test/m2m/data/cost_grid.dbf')
> OperationalError: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Data
> source name not found and no default driver specified', 6044)
>  
> What am I doing wrong and what do I need to do?  Any help would be
> greatly appreciated.

John,

The error message is quite clear: Python cannot connect to the data 
source you have given. It is always best to set up ODBC data sources 
using an ODBC manager. In Windows this is done through Control Panel -> 
Administration -> Data Sources. Set up your data source and test it here 
before trying to connect using Python.

Charlie



More information about the egenix-users mailing list