[egenix-users] unixODBC SQLSEVER OUPUT issue

M.-A. Lemburg mal at egenix.com
Mon Apr 20 17:57:24 CEST 2009


On 2009-04-20 15:26, akm wrote:
> Hi  All,
> 
> The query given below is supposed to return all columns from the table
> 'table_name'  for the record with user '111'.
> I am not getting any result from linux while excuting fetchone() , but
> it works fine in windows.
> 
> Can anyone give me a pointer why this occurs ?

It's possible that MS SQL Server puts the output into a separate
result set.

You can use cursor.nextset() to jump to the next available result
set.

> #test.py
> query = """update table_name
>                           set upd_dt = getdate(),
>                           user =222,
>                 OUPUT INSERTED.*
>                       where user =  111,
>                """
> 
> def connectToDataBase(connstr):
>     if sys.platform == 'win32':
>         from mx.ODBC import Windows
>     db = Windows.DriverConnect(connstr, clear_auto_commit = 1)
>         conn = db.cursor()
>     else:
>         from mx.ODBC import unixODBC
>         db = unixODBC.DriverConnect(connstr, clear_auto_commit = 1)
>         conn = db.cursor()
>     conn.execute(result)
>     print conn.fetchone()
> 
> if __name__ == '__main__':
>     print connectToDataBase('dsn=sb;uid=user;pwd=passwd')
> 
> 
> Thanks,
> Abdul Kader M
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> https://www.egenix.com/mailman/listinfo/egenix-users

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Apr 20 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the egenix-users mailing list