jangbagu / pypyodbc

Automatically exported from code.google.com/p/pypyodbc
0 stars 0 forks source link

Data source name not found, and no default driver specified #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Configure driver and DSN in odbcinst.ini and odbc.ini
2. Call pypyodbc.connect() with 'DRIVER={driver};...'

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

I would expect to get a connection back, as it works with isql and pyodbc.

Instead, I get this:

  File "db.py", line 141, in db_connection
    cnxn = pyodbc.connect(cnstring, autocommit=autocommit)
  File "/home/foo/.virtualenvs/env/lib/python2.6/site-packages/pypyodbc.py", line 1729, in connect
    return odbc(connectString, autocommit, ansi, timeout, unicode_results, readonly)
  File "/home/foo/.virtualenvs/env/lib/python2.6/site-packages/pypyodbc.py", line 1544, in __init__
    self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly)
  File "/home/foo/.virtualenvs/env/lib/python2.6/site-packages/pypyodbc.py", line 1573, in connect
    validate(ret, SQL_HANDLE_DBC, self.dbc_h)
  File "/home/foo/.virtualenvs/env/lib/python2.6/site-packages/pypyodbc.py", line 627, in validate
    ctrl_err(handle_type, handle, ret)
  File "/home/foo/.virtualenvs/env/lib/python2.6/site-packages/pypyodbc.py", line 612, in ctrl_err
    raise Error(state,err_text)
pypyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name 
not found, and no default driver specified')

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

pypyodbc 0.8.6
python 2.6
SuSE Linux Enterprise 11.3

Please provide any additional information below.
Doesn't work with system configuration files, user files, or 
local+ODBCINI+ODBCSYSINI. All of those work with isql and pyodbc.

Original issue reported on code.google.com by felix.m...@gmail.com on 5 Oct 2012 at 11:28

GoogleCodeExporter commented 8 years ago
Same problem with:

pypyodbc trunk
python-2.7.3 / pypy-1.9
unixODBC-2.3.1
Gentoo Linux

Original comment by sok...@gmail.com on 8 Oct 2012 at 1:58

GoogleCodeExporter commented 8 years ago

Original comment by jiangwen...@gmail.com on 8 Oct 2012 at 1:33

GoogleCodeExporter commented 8 years ago
This should now work fine with the svn head / hg tip revision.

Relevant changeset: 
https://bitbucket.org/jiangwen365/pypyodbc/commits/23cbcaaea1db6bab505ca7b9b404b
893cfb7dd6f

Previously, when using wide Python build with connection string 
'DRIVER={driver};...', only the first character (uppercase D) is passed to 
unixODBC, thus causing the error "Data source name not found, and no default 
driver specified"

Original comment by sok...@gmail.com on 14 Jan 2013 at 7:48

GoogleCodeExporter commented 8 years ago
Thanks for the feed back, I'm going to close the ticket.

Original comment by jiangwen...@gmail.com on 14 Jan 2013 at 7:52

GoogleCodeExporter commented 8 years ago
Hi Felix, can you try the latest 0.9.3 and see if this problem has been fixed?

Original comment by jiangwen...@gmail.com on 15 Feb 2013 at 2:47

GoogleCodeExporter commented 8 years ago

Original comment by jiangwen...@gmail.com on 22 Feb 2013 at 5:44

GoogleCodeExporter commented 8 years ago

Original comment by jiangwen...@gmail.com on 23 Mar 2013 at 11:41

GoogleCodeExporter commented 8 years ago
I know this bug was closed a while ago, but I am having the exact same problem 
on Mac OS X with pypyodbc v.1.3.3, python 2.7.5. Is there any chance this was 
only fixed for Linux, and not Mac?

Original comment by macaven...@gmail.com on 1 Jul 2014 at 9:00