[egenix-users] Windows ODBC DataSource Names

M.-A. Lemburg mal at egenix.com
Sun Jan 30 22:46:52 CET 2005


Bob Gibson wrote:
> 
> 
> 
> 1. Is there a way to define an ODBC Datasource in Windows, such that one
> can
>    specify the database name at the time the connection is requested?

It is possible to connect to data source that are not
configured in the ODBC manager by defining the data source
in the connection string, provided that you know the
name of ODBC driver:
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcconnecting_directly_to_drivers.asp

Example:

db = mx.ODBC.Windows("DRIVER={SQL Server};SERVER=hrserver;UID=Smith;PWD=Sesame")
cursor = db.cursor()
...

This example is for the MS SQL Server. More information is available
at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbcsql/od_odbc_d_4x4k.asp

> 2. How could the "mx.ODBC.print_resultset(c)" on you examples page work?
> 
>      http://egenix.com/files/python/mxODBC.html#Examples
> 
>    Shouldn't you get "NameError: name 'mx' is not defined"

Indeed. Those examples were copied from an interactive
session and it looks as if we forgot the "import mx.ODBC"
in the printout.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 28 2005)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list