methew / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Version 3.0.6 doesn't process /etc/odbc.ini properly #298

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Set up configuration file in /etc/odbc.ini, with D3DRDB as a DSN
2. Run python script
import pyodbc
pyodbc.connect('DSN=D3DRDB,UID=me,PWD=password')

What is the expected output? What do you see instead?

I expect this to work, as it does for python version 2.6, pyodbc version 
2.1.7-beta0.  Instead I see

pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not 
found, and no default driver specified (0) (SQLDriverConnect)')

Also, before I run pyodbc.connect, there is no ~/.odbc.ini file; after I try to 
run pyodbc.connect there is a ~/.odbc.ini file.  I expect there to be no 
~/.odbc.ini file after I run

What version of the product are you using? On what operating system?

I am using python2.7 on Linux:

uname -a
Linux venusa 2.6.18-308.4.1.el5 #1 SMP Tue Apr 17 17:08:00 EDT 2012 x86_64 
x86_64 x86_64 GNU/Linux

Please provide any additional information below.

I installed from pip.

Original issue reported on code.google.com by smithfam...@gmail.com on 8 Nov 2012 at 10:37

GoogleCodeExporter commented 9 years ago
This was a red herring for my difficulties.  When I reverted to 2.1.7-beta0 on 
the python2.7 installation, I still had the problem of creating a blank 
~/.odbc.ini.  It turns out there was a <prefix>/etc/odbc.ini file that was also 
blank, which was being referenced. When I updated <prefix>/etc/odbc.ini to be 
what was in /etc/odbc.ini, it finally worked.

HOWEVER, pyodbc.connect still produces a blank ~/.odbc.ini file.  Whether this 
is an issue with pyodbc, or just odbc, I don't know.

Original comment by smithfam...@gmail.com on 8 Nov 2012 at 11:31