python <==> ado

Gaetan Corneau Gaetan_Corneau at baan.com
Tue Jan 25 09:26:17 EST 2000


Hello,

> i would like to connect to an sqlserver 7.0 database with ado.
> the database is on a different pc on the network.
> does anyone know the command to get a connection?

Quite easy. Here is an example for Oracle (it would be the same for MS-SQL
except for the connect string):

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from win32com.client.dynamic import Dispatch
>>> Conn = Dispatch("ADODB.Connection")
>>> Conn.Open("DSN=itktest;uid=itk_sch_test;pwd=itk_sch_test")

Hope this helps,
______________________________________________________
   Gaetan Corneau
   Software Developer 
   Software Engineering Process Group
   BaaN  Supply Chain Solutions  
   http://www.baan.com
   E-mail: Gaetan_Corneau at baan.com                  
   Tel: (418) 266-8252         
______________________________________________________
"Profanity is the one language all programmers know best"


-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/B/MU d- s+:++ a+ C++ 
UL+ P--- W+ N- K- W++ t-- 
!5 X- R+ tv-- b++ DI++ 
G e++ h---- r+++ y++++
------END GEEK CODE BLOCK------




More information about the Python-list mailing list