Giter VIP home page Giter VIP logo

Comments (3)

mdobrzanski avatar mdobrzanski commented on August 15, 2024

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
vary by Linux distro). Then

wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.0.tar.gz
tar zxvf unixODBC-2.3.0.tar.gz
cd unixODBC-2.3.0
./configure
make
sudo make install

As root ensure that /usr/local/etc/odbcinst.ini has the following
entries:

[FreeTDS]
Driver          = /usr/local/lib/libtdsodbc.so

[SQLServer]
Driver          = /usr/local/lib/libtdsodbc.so

The second entry is for aesthetics only - so you can use "SQLServer"
in your connection strings. Odbc.ini file is not important if you use
fully qualified host names in your connection string but at your
option you may configure DSNs there.

FreeTDS

Also uninstall any system packages that you may have for this, then:

wget http://www.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
tar xvf freetds-stable.tgz
cd freetds-0.91
./configure --with-unixodbc=/usr/local  --enable-msdblib --with-
tdsver=8.0
make
sudo make install

Remove or otherwise disable /etc/freetds.conf if any. Modify /usr/
local/etc/freetds.conf to read as follows:

[global]
        # TDS protocol version
        tds version = 8.0
        client charset = UTF-8
        # This is probably not needed...
        text size = 64512
# Typical SQLServer
[server_name]
        host = hostname.somedomain
        port = 2431
        tds version = 8.0

At this point you should be able to login successfully using:

tsql -S server_name -U username -P password
or
isql Database username password

Pyodbc

git clone https://github.com/mkleehammer/pyodbc.git
python setup.py bdist_egg
cd dist
easy_install pyodbc-3.0.2_beta01-py2.6-linux-i686.egg  # filename may vary based on architecture
#pyodbc_sand.py

import pyodbc
con = pyodbc.connect('DSN=Northwind; UID=vte; PWD=vte')
sqlstr = "select * from Customers where CustomerID = (?)"

cur = con.cursor()
q = cur.execute(sqlstr, u'ĄŁÓ$!')
res = q.fetchall()
print res
#output: [(u'\u0104\u0141\xd3$!', u'URL Encoders', None, None, None, None, None, None, None, None, None)]

from pyodbc.

maparent avatar maparent commented on August 15, 2024

Look at my pull request, I suspect it's relevant. I have had the same issue with Virtuoso and solved it with
settings['extra_compile_args'].append('-DSQL_WCHART_CONVERT=1')

from pyodbc.

mkleehammer avatar mkleehammer commented on August 15, 2024

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?

from pyodbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.