Issue 13: Problem fetching NTEXT and NVARCHAR data
Status:  NoFix
Owner: ----
Closed:  Dec 2009
Reported by timothy....@gmail.com, Dec 12, 2008
What steps will reproduce the problem?
1. Create NVARCHAR (or NTEXT) column in MSSQL 2005 Express database table.
   create table test_nvarchar (id int identity, nvarchar_col nvarchar(10))
    
   -- Insert capital U with double acute.
   insert into test_nvarchar values (N'Ű')
2. Run this python script on RedHat 9:

import pyodbc
cnxn = pyodbc.connect("DSN=SQLSERVER_SAMPLE")
cursor = cnxn.cursor()
cursor.execute("select * from test_nvarchar where id = 1")
for row in cursor:
    print row.nvarchar_col
    print repr(row.nvarchar_col

What is the expected output?
Ű
u'\u0170    '


What do you see instead?

u''

What version of the product are you using? On what operating system?
redhat 9
pyodbc 2.1.2
python 2.5.1 (UCS-2 build)
Easysoft SQL Server ODBC driver 1.1.4
SQL Server 2005 Express

Please provide any additional information below.
The script works as expected with the same setup if pyodbc 2.0.58 is used
or a "hybrid" 2.1.2 built with the 2.0.58 getdata.cpp.


Dec 12, 2008
Project Member #1 mkleehammer
OK, this is something wierd.  It works on Windows just fine, so there is something
about the combination of Easysoft and Linux.

Is it possible to get an ODBC trace of the 2.1.2 that fails and the 2.0.58 that works
so I can compare them?

Status: Investigating
Dec 15, 2008
#2 timothy....@gmail.com
Please find attached.
unixodbc.zip
6.4 KB   Download
Mar 18, 2009
Project Member #3 mkleehammer
I'm not ignoring this, but I have not been able to get my Linux system to connect to
my test SQL Server instance.  Networking issues w/ Vista & Windows 7.  sigh.

The traces looked nearly identical, so it is clearly something in the GetDataString
function.  Unfortunately the newer function is more correct.  I'm concerned there is
a problem with the driver.
Aug 28, 2009
#4 real.jav...@gmail.com
I'm using 
- pyodbx-2.1.6
- unixODBC 2.2.12
- python2.6
on a Red Hat Enterprise (32)
to talk to SQL Server 2005.

I just want to comment that I think you are right that this is a driver problem.
I initially tested pyodbc using Easysoft SQL Server ODBC driver 1.1.4 and had the
same problem with Tim. Since I don't want to pay for the license ($$$$$), I ended up
installing FreeTDS 0.82 and found that the problem goes away. Configuration was
definitely harder for FreeTDS but the result is awesome. Hail to pyodbc and FreeTDS.
Dec 31, 2009
Project Member #5 mkleehammer
(No comment was entered for this change.)
Status: Invalid
Nov 21, 2010
Project Member #6 mkleehammer
(No comment was entered for this change.)
Status: NoFix