Connecting to SQL database

thebjorn BjornSteinarFjeldPettersen at gmail.com
Thu Dec 20 17:03:28 EST 2007


On Dec 20, 10:01 pm, bill ramsay <blah at blahdeblah> wrote:
> On Fri, 14 Dec 2007 23:35:00 -0300, "Gabriel Genellina"
>
> <gagsl-... at yahoo.com.ar> wrote:
> >En Fri, 14 Dec 2007 23:24:24 -0300, Unknown <unkn... at unknown.invalid>
> >escribió:
>
> >> I have successfully connected to SQL2000 and MSDEE databases in the
> >> past,  however I have to move to SQL2005 and SQLEXPRESS databases now.
>
> >>     Conn.ConnectionString = "Provider=SQLNCLI;Server=10.1.1.2;
> >> Database=csrctest;Uid=bill;Pwd=bill"
>
> >Look for the right spelling athttp://www.connectionstrings.com/
>
> looks like my spelling is ok,  any other ideas?
>
> thanks for the suggestion above.
>
> kind regards
>
> bill

This is working for me to the internal network (I'm using adodbapi,
but the connection string should be the same)

  'Provider=sqloledb;Data Source=dbserv;Initial Catalog=ndb;User
Id=foo;Password=bar;'

I just tested, and this works well too

  'Provider=SQLNCLI;Data Source=dbserv;Initial Catalog=ndb;User
Id=foo;Password=bar;'

and to my local instance (Hermes is my machine)

  'Provider=SQLNCLI;Data Source=HERMES\\SQLEXPRESS;Initial
Catalog=;User Id=sa;Password=pw666;'

Can you connect to the server using SqlServer Management Studio? Can
you create an odbc connection to the server? Unlike 2000, SqlServer
2005 has tcp/ip connections turned off by default, so you might want
to check that with the SqlServer Surface Area Configuration tool.

Externally we're still running 2000, so I don't know how connecting
over the interweb differs.

When you've figured out how to connect, and if you're open to a
suggestion, you might want to try out the adodbapi package (http://
adodbapi.sourceforge.net/). It is a thin wrapper over ADO, and works
quite well. Then you'll get to use the Python db-api v.2.0 syntax,
which is oodles less typing than straight ADO.

-- bjorn




More information about the Python-list mailing list