Is it possible for me to connect to a MS SQL-Server from a UNIX box via Python
(2.3)? I'm assuming I would need a driver, but I looked on microsoft.com and
could not find anything. Anyone out there ever try to do this?
Thanks
--greg
-----------------------------------------------------------------------------
This message was sent using Conway Corporation WebMail -- www.conwaycorp.net
>
> Hello-
>
> Is it possible for me to connect to a MS SQL-Server from a UNIX box via
> Python
> (2.3)? I'm assuming I would need a driver, but I looked on microsoft.com
> and
> could not find anything. Anyone out there ever try to do this?
No surprise - microsoft wont do that for you...
What you need is unix-odbc, the freedts-driver and pyodbc - google for
them, and use the latest versions.
--
Regards,
Diez B. Roggisch
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
be...@benjiyork.com