Connecting to SQL database

Rob Williscroft rtw at freenet.co.uk
Thu Dec 20 17:18:30 EST 2007


bill ramsay wrote in news:5rd6m319dcdftfdsnblgda29ofp9akh9rb at 4ax.com in
comp.lang.python: 

> Hi
> 
> I have successfully connected to SQL2000 and MSDEE databases in the

> 
>     Conn = Dispatch('ADODB.Connection')
>     Conn.ConnectionString = "Provider=SQLNCLI;Server=10.1.1.2;
> Database=csrctest;Uid=bill;Pwd=bill"

By default SQL 2005 doesn't enable the TCP/IP protocol, if your app'
is running on the same machine use either the machine name or a
period (.) and it will use the Shared Memory protocol.

You will also need the server instance name(*), so it would be:

  "Provider=SQLNCLI;Server=.\SQLEXPRESS;Datab..."

*) IIRC you can't install express as the "Default" instance so
this will be required.

If you need to enable TCP/IP use the "SQL Server Configuration Manager"
about 4 levels deep from the "Start" menu.  Remember to enable it for
the server and SQLNCLI.

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list