[freetds] unixodbc and character identifier limits?

Lukasz Szybalski szybalski at gmail.com
Thu Apr 17 11:16:26 EDT 2008


On Fri, Apr 11, 2008 at 6:14 PM, James K. Lowden <jklowden at freetds.org> wrote:
> Lukasz Szybalski wrote:
>  > ok I switched to 7.0 but while using pyodbc / ceodbc I get the
>  > following:
>  >
>  > >>> connection =
>  > >ceODBC.Connection("DRIVER={TDS};Server=xxx;UID=xxx;PWD=xxx") >>
>  > >c=connection.cursor()
>  >  >>> c.execute('select xxxxxxx.HISTORY_NUMBER as
>  > xxxxxx_xxxxxx_HISTORY_NUMBER_38_THIS_IS_OVER_30 from
>  > xxxxxx').fetchone()
>  >
>  > ('    7547',)
>  > >>> print c.description
>  > [('xxxxxx_xxxxx_HISTORY_NUMBER_38_TH', <type 'ceODBC.StringVar'>, 8,
>  > 8, 0, 0, False
>  >
>  > As you can see the description is cut off?
>  > When I specify the DRIVER={TDS} is that going through
>  > /etc/freetds/freetds.conf ?
>
>  http://www.freetds.org/0.82/userguide/odbcconnattr.htm
>  http://www.freetds.org/0.82/userguide/dsnless.htm
>
>  No.  You're using "Server", not "Servername".  And I think you are using
>  DSN-less connection i.e., specifying all connection attributes in the
>  command string.
>
>  To use TDS 7.0 in a DSN-less connection, your options are:
>
>  1.  Rebuild FreeTDS --with-tdsver=7.0, or
>  2.  Set the environment variable TDSVER=7.0 before starting Python, or
>  3.  Add "TDS_Version=7.0;" to your connection string.
>  4.  Use "Servername" in your connection string.
>
>  Any of those should work.
>

Thanks,
adding TDS_Version works in ceodbc/pyodbc.

import ceODBC
connection = ceODBC.Connection("SERVER=xxx;UID=xx;PWD=xxx;DRIVER={TDS};TDS_Version=7.0")
c=connection.cursor()
c.execute('select xxx.xxxxxx_HISTORY_NUMBER_38 as
xxxxxxxx_HISTORY_NUMBER_38_THIS_IS_OVER_30 from xxxx').fetchone()
('    7547',)
print c.description
[('xxxxxxxxx_HISTORY_NUMBER_38_THIS_IS_OVER_30', <type
'ceODBC.StringVar'>, 8, 8, 0, 0, False)]
}}}

Is there a reason default in freetds.conf is still set so low?

http://www.freetds.org/tds.html

sqlserver 2000 is running 8.0

Thanks for your help.
Lucas

on Debian Linux, using freetds and unixodbc I was able to use
sqlalchemy via pyodbc to connect to sqlserver 2000, by adding
DRIVER={TDS} and TDS_VERSION=7.0. I'll would go with 8.0 maybe and see
how that works.



More information about the FreeTDS mailing list