mxODBC: File DSNs?
M.-A. Lemburg
mal at lemburg.com
Thu Sep 9 18:56:27 EDT 1999
Greg Ewing wrote:
>
> "M.-A. Lemburg" wrote:
> >
> > Just add the File DSN to your ODBC Manager setup and then point
> > mxODBC at it using ODBC.Windows.DriverConnect().
>
> This doesn't work.
>
> Under the "File DSN" tab in the ODBC Data Source Administrator
> I have an entry called "Py2kTest2.dsn" which refers to a
> Microsoft Access database. But "Py2kTest2" or "Py2kTest2.dsn"
> does not seem to be a valid data source name:
>
> >>> db = ODBC.Windows.DriverConnect("DSN=Py2kTest2")
> Traceback (innermost last):
> File "<pyshell#11>", line 1, in ?
> db = OW.DriverConnect("DSN=Py2kTest2")
> OperationalError: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Data
> source name not found and no default driver specified', 4316)
>
> >>> db2 = ODBC.Windows.DriverConnect("DSN=Py2kTest2.dsn")
> Traceback (innermost last):
> File "<pyshell#13>", line 1, in ?
> db2 = ODBC.Windows.DriverConnect("DSN=Py2kTest2.dsn")
> OperationalError: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Data
> source name not found and no
> default driver specified', 4316)
>
> If I create a User DSN with the same parameters, everything
> is fine.
>
> What magic string do I need to give to DriverConnect to
> specify a File DSN?
Try "FILEDSN=<dsn filename>" as parameter. The ODBC docs for
SQLDriverConnect have more details on the dsn string to be
used.
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 113 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/
More information about the Python-list
mailing list