Connecting to SQL database

kyosohma at gmail.com kyosohma at gmail.com
Thu Dec 20 16:16:03 EST 2007


On Dec 14, 8:24 pm, bill ramsay <blah at blahdeblah> wrote:
> Hi
>
> I have successfully connected to SQL2000 and MSDEE databases in the
> past,  however I have to move to SQL2005 and SQLEXPRESS databases now.
>
> I've tried the following but with no luck [this is what i used in the
> earlier incarnation except the Provider resource was SQLOLEDB.1]
>
>     Conn = Dispatch('ADODB.Connection')
>     Conn.ConnectionString = "Provider=SQLNCLI;Server=10.1.1.2;
> Database=csrctest;Uid=bill;Pwd=bill"
>     print Conn.ConnectionString
>
>     try:
>         print 'trying to open'
>         Conn.Open()
>
>         etc.
>
> All I ever get to is the trying to openline,  then it times out.
>
> I have tried all of the following combinations too:
>
> Provider=SQLNCLI;Server=localhost;Database=csrctest;Uid=bill;Pwd=bill;
>
> Provider=SQLNCLI;Server=localhost\SQLEXPRESS;Database=csrctest;Uid=bill;Pwd=bill;
>
> The SQLEXPRESS database for testing purposes is on my home PC
> [10.1.1.2]
>
> Any clues s to where I am going wrong?
>
> Look forward to hearing from someone,  anyone!!
>
> Kind regards
>
> Bill

You might try pymssql:

http://pymssql.sourceforge.net/

I've only used it with MSSQL2000, but according to the website, it
should work with 2005 too.

If you wrapped your database interface with SQLObject or SQLAlchemy,
then (as I understand it) the sql connector module can be swapped out
with little to no work. I hope to move to one of those sooner or
later:

http://www.sqlobject.org/
http://www.sqlalchemy.org/

Mike



More information about the Python-list mailing list