TLDR: Don't use the unicode drivers, use ansi!
I want to connect to a DB via TurbODBC instead of Pandas/SQLAlchemy.
What I did by now:
Now I tried to do the following:
from turbodbc import connect
connect(dsn="mydsn", user="myuser", password="mypass")
and got the following error message:
---------------------------------------------------------------------------
DatabaseError Traceback (most recent call last)
<ipython-input-2-bbbc3a4c2880> in <module>()
----> 1 connect(dsn="mydsn", user="myuser", password="mypass")
/Users/myuser/anaconda2/lib/python2.7/site-packages/turbodbc/exceptions.pyc in wrapper(*args, **kwds)
31 return f(*args, **kwds)
32 except InternError as e:
---> 33 raise DatabaseError(str(e))
34 return wrapper
DatabaseError: ODBC error
state: H
I don't know what to do now and didn't found any issues regarding this error.
I'd be very happy if anybody could help me, thanks in advance! ;-)
I tried in R with RODBC, worked fine. So I'm sure this is a problem of TurbODBC, but am not able by now to debug the (C++ i think) code....
I changed the Mysql Connector for ODBC driver in the settings file .odbc.ini
to the ansi driver. I thought this has to be the unicode due to the Database, which contains unicode tables... but with ansi, everything works fine (only) when I set the encoding by manual to utf8 in the settings file while using ansi driver. Don't know why or how the error occurs, but this workaround works.
Here are a few suggestions:
isql <dsn> <user> <password> -v
. odbc.ini
. This is accomplished with export ODBCINI=/path/to/odbc.ini
. odbc.ini
until isql
can connect successfully. Then try turbodbc again. If you still think it is a bug, please report it at https://github.com/blue-yonder/turbodbc/issues .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.