Connecting to SQL Server from UNIX
Benji York
benji at benjiyork.com
Sat Oct 23 21:22:31 EDT 2004
More information about the Python-list mailing list
Sat Oct 23 21:22:31 EDT 2004
- Previous message (by thread): Connecting to SQL Server from UNIX
- Next message (by thread): structured unpacking assignments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
yuba at conwaycorp.net wrote: > Is it possible for me to connect to a MS SQL-Server from a UNIX box via Python > (2.3)? Check out ODBTP (http://odbtp.sourceforge.net/) and my (alpha) Python DB API 2.0 bindings for it (http://benjiyork.com/odbtp.html). You install the ODBTP service on a Windows machine (the one with SQL Server or a different one) and use the ODBTP client to connect to it from Unix, Linux, Windows, etcetera. Here's a small example program: import odbtpapi connectString = 'Driver=SQL Server;Server=10.0.0.1;UID=sa;PWD=thepassword;' connection = odbtpapi.connection(connectString, server='10.0.0.2') cursor = connection.cursor() sql = 'select * from MyDatabase..MyTable where someColumn = ?' cursor.execute(sql, ['A Value']) for row in cursor.fetchall(): print row print cursor.description -- Benji York benji at benjiyork.com
- Previous message (by thread): Connecting to SQL Server from UNIX
- Next message (by thread): structured unpacking assignments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list