-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unicode parameters on pyodbc -> unixodbc -> freetds #1
Comments
Have you tried querying with tsql and isql? This may not be pyodbc issue. I had this problem with selecting with unicode parameter and I've installed from sources freetds 0.91, unixODBX 2.3.0 and latest pyodbc. quoting http://groups.google.com/group/sqlalchemy/browse_thread/thread/971e068032d51dd5 this is what has worked for me on ubuntu 10.04 unixODBC First I removed system packages unixODBC and unixODBC-dev (names may
As root ensure that /usr/local/etc/odbcinst.ini has the following
The second entry is for aesthetics only - so you can use "SQLServer" FreeTDS Also uninstall any system packages that you may have for this, then:
Remove or otherwise disable /etc/freetds.conf if any. Modify /usr/
At this point you should be able to login successfully using: tsql -S server_name -U username -P password Pyodbc
|
Look at my pull request, I suspect it's relevant. I have had the same issue with Virtuoso and solved it with |
If you use the default unixODBC build (2-byte UCS2) this should now work on 3.0.10 (not built yet). Can you try the master branch and confirm? |
* Merging updates. (#1) Merging updates. * fix for smalldatetime issue * Fixed a bad merge * Fix for inserting high unicode chars * merge with main branch * Fix for function sequence error * reverted unnecessary file changes * removed obsolete include
* Merging updates. (#1) Merging updates. * fix for smalldatetime issue * Fixed a bad merge * Fix for inserting high unicode chars * merge with main branch * Fix for function sequence error * reverted unnecessary file changes * removed obsolete include * Preliminary implementation of TVP * Fix size for float * Fix size for GUID * Small TVP fixes and tests
Merging updates.
* Merging updates. (#1) Merging updates. * fix for smalldatetime issue * Fixed a bad merge * Fix for inserting high unicode chars * merge with main branch * Fix for function sequence error * reverted unnecessary file changes * removed obsolete include * fix for 540 * fix for TVP type mismatch issue * Combined the IFs
* Merging updates. (#1) Merging updates. * fix for smalldatetime issue * Fixed a bad merge * Fix for inserting high unicode chars * merge with main branch * Fix for function sequence error * reverted unnecessary file changes * removed obsolete include * fix for 540 * fix for TVP type mismatch issue * Combined the IFs * Fix for high unicode insertion, WIP * Fix python2 high unicode insertion * Renamed a table to t1
* Merging updates. (#1) Merging updates. * fix for smalldatetime issue * Fixed a bad merge * Fix for inserting high unicode chars * merge with main branch * Fix for function sequence error * reverted unnecessary file changes * removed obsolete include * fix for 540 * fix for TVP type mismatch issue * Combined the IFs * Fix for high unicode insertion, WIP * Fix python2 high unicode insertion * Renamed a table to t1 Co-authored-by: v-chojas <25211973+v-chojas@users.noreply.github.com> Co-authored-by: Michael Kleehammer <michael@kleehammer.com>
* Merging updates. (#1) Merging updates. * fix for smalldatetime issue * Fixed a bad merge * Fix for inserting high unicode chars * merge with main branch * Fix for function sequence error * reverted unnecessary file changes * removed obsolete include * fix for 540 * fix for TVP type mismatch issue * Combined the IFs * Fix for threading issues when using SQLDrivers and SQLDataSources Co-authored-by: v-chojas <25211973+v-chojas@users.noreply.github.com> Co-authored-by: v-chojas <v-chojas@microsoft.com>
Function create_name_map used a static buffer `szName[300]` for the column name in call to `SQLDescribeColW`. That function would truncate the column name to the size of the provided buffer, but return the actual length of the column name in the `&cchName` return parameter. That `cchName` output was used to compute `cbName` parameter for the call to `TextBufferToObject(enc, szName, cbName)`. When the actual column name was longer than the buffer, cbName was to big, and was causing a buffer overflow, resulting in crashes, invalid data, or errors. Fix this by making szName a dynamic buffer. This buffer overflow is very similar to the one fixed in mkleehammer#881. I check through the rest of the code base, and I don't see more places with static buffers that could have a similar issue. Upstream PR: mkleehammer#931
I am using Ubuntu 9.04
I have installed the following package versions:
I have configured /etc/unixodbc.ini like this:
I have configured /etc/freetds/freetds.conf like this:
I have grabbed pyodbc revision 31e2fae from http://github.com/mkleehammer/pyodbc and installed it using "python setup.py install"
I have a windows machine with Microsoft SQL Server 2000 installed on my local network, up and listening on the local ip address 10.32.42.69. I have an empty database created with name "Common". I have the user "sa" with password "secret" with full priviledges.
I am using the following python code to setup the connection:
Everything WORKS up to this point. I have used SQLServer's Enterprise Manager on the server and the new table is there. Now I want to insert some data on the table.
That fails!! Seems like pyodbc won't accept a unicode object. Here's the error I get:
Since my freetds client is configured to use UTF-8 as above, I thought I could solve by encoding data to UTF-8. That gives no error, but then I get back strange data when I query. pyodbc returns unicode strings, and decoded with the wrong encoding so the chars are wrong.
If I can't insert an unicode string, why do I get those back? And wrong?
The text was updated successfully, but these errors were encountered: