tanrj / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Problem fetching NTEXT and NVARCHAR data #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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.

Original issue reported on code.google.com by timothy....@gmail.com on 12 Dec 2008 at 4:50

GoogleCodeExporter commented 8 years ago
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?

Original comment by mkleehammer on 12 Dec 2008 at 7:18

GoogleCodeExporter commented 8 years ago
Please find attached.

Original comment by timothy....@gmail.com on 15 Dec 2008 at 9:42

Attachments:

GoogleCodeExporter commented 8 years ago
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.

Original comment by mkleehammer on 18 Mar 2009 at 3:51

GoogleCodeExporter commented 8 years ago
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.

Original comment by real.jav...@gmail.com on 28 Aug 2009 at 8:50

GoogleCodeExporter commented 8 years ago

Original comment by mkleehammer on 1 Jan 2010 at 6:45

GoogleCodeExporter commented 8 years ago

Original comment by mkleehammer on 21 Nov 2010 at 4:43