[freetds] unixodbc and character identifier limits?

James K. Lowden jklowden at freetds.org
Fri Apr 11 19:14:28 EDT 2008


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.  

> How could I replicate this in isql?

Please see app/bsqlodbc and its man page.  isql has some limitations that
can be misleading.  

HTH.  

--jkl



More information about the FreeTDS mailing list