My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 339: pyodbc Not returning results with Python3.3 on Mac OS X
3 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


 
Reported by nbed...@reddeer.gb.com, Sep 19, 2013
What steps will reproduce the problem?
1. Install unixodbc
2. install FreeTDs
3. Install pyodbc

What is the expected output? What do you see instead?
Run select query - expect db results - 

get "pyodbc.ProgrammingError: No results.  Previous SQL was not a query."

What version of the product are you using? On what operating system?
Python 3.3.2 FreeTDS 0.9.1, pyodbc 3.0.7 Mac OS X 10.8.3


Please provide any additional information below.
I've been fighting this one for a while.  This is the code:

conn = pyodbc.connect('TDS_VERSION=7.2;charset=UTF-8;DRIVER=/usr/local/lib/libtdsodbc.so;DATABASE=test;SERVER=<SQL SERVER>;PORT=1433;UID=<UID>;PWD=<PASSWORD>')
csr = conn.cursor()
csr.execute(str("select id, value from test"))
rows = csr.fetchall()

The code works on Python 2.7 with pyodbc installed from the same source code as used in python 3.  I've also tried it in a Python3 virtualenv with pyodbc installed via pip.

Changing charset to UTF8, UTF16 or UTF-16 seems to have no effect.  Nor does changing TDS_VERSION to 8.0.



Sep 26, 2013
#1 nbed...@reddeer.gb.com
An update on this.  It looks like a Unicode problem.  When running the code in the console (as opposed to Eclipse with PyDev) I get:  pyodbc.ProgrammingError: ('42000', "[42000] [FreeTDS][SQL Server]Incorrect syntax near '�'. (102) (SQLExecDirectW)").  

Powered by Google Project Hosting