I made some progress: the buildout-installed unixodbc got installed
in /var/zope/..../buildout/parts/unixodbc, and the .ini files were in
an etc folder under that, as expected. I copied them to /etc, and
then it all started working again.
For a pyodbc egg that's downloaded and installed by buildout (and in a
python virtual environment, at that) I would expect it to know *not*
to use the system-wide /etc files. I would love to be able to
configure pyodbc in buildout to tell it explicitly where to grab the
ini files from.
Thanks, Alec! First I tried your advice, too, but it didn't work.
The thing is, both freetds and unixodbc were already working fine,
since I did have valid freetds.conf, odbcinst.ini and odbc.ini files,
as evidenced by running the command-line tools tsql and isql,
respectively. It really was pyodbc that couldn't find the driver
manager.
Thanks all!
> I don't think it's an issue of pyodbc not seeing unixODBC, rather a
> configuration problem. If I try to connect like your example I get the same
> error. If you can't figure it out, you can try it like this:
>
> >>> import pyodbc
> >>> conn = pyodbc.connect("DSN=database;UID=username;PWD=password")
>
> where the "database" matches an entry from your odbc.ini file.
>
> Define a server instance in freetds.conf (host, port, tds version)
> Define a driver in odbcinst.ini
> Define a database instance in odbc.ini - where the Driver matches one from
> odbcinst.ini and the Servername matches one from freetds.conf
>
> If you want to see examples of each config let me know.
>
> On Fri, Jul 2, 2010 at 12:25 AM, fulv <
fulviocas...@gmail.com> wrote:
> > I have freetds and unixodbc, and they both work fine, as I verified
> > with tsql and isql. But I have a problem with pyodbc:
>
> > >>> import pyodbc
> > >>> conn =
> > pyodbc.connect("DRIVER={TDS};Server=......;Database=......;UID=.....;PWD=....")
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source
> > name not found, and no default driver specified (0)
> > (SQLDriverConnectW)')
>
> > The bigger picture is that I am trying to install this in a Zope
> > buildout, and I have pysql in the eggs list for the instance, but I
> > have freetds and unixodbc built by the following buildout parts:
>
> > [freetds]
> > recipe = zc.recipe.cmmi
> > url =
> >
ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
> > extra_options = --with-tdsver=8.0
>
> > [unixodbc]
> > recipe = zc.recipe.cmmi
> > url =
http://www.unixodbc.org/unixODBC-2.3.0.tar.gz
>
> > Could it be that pyodbc does not see the buildout-made unixodbc? And
> > if so, how do I change buildout to make pyodbc build correctly?
>
> > Or what else could be the problem?
>
> > Thanks!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "pyodbc" group.
> > To post to this group, send email to
pyo...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
pyodbc+un...@googlegroups.com<
pyodbc%2Bunsu...@googlegroups.com>
> > .