Menu

Simple Database Connectivity

2009-07-20
2013-04-29
  • Ray Charles

    Ray Charles - 2009-07-20

    Hello,
    I am trying to interpret the following line :

    conn = pymssql.connect(host='SQL01', user='user', password='password', database='mydatabase')

    1)The host would be the ip address which I can pull up through 'Ipconfig' at the CMD
    2)The username and password would be the same as my windows username and password cuz im using windows authentication for sql.
    3)the database would be the name of my database in sql

    Under this interpretation when I run my code the IDE hangs (pythonwin)
    Please advise.

    (Sorry if this question is too too fundamental)

     
    • A

      A - 2009-07-20

      I don't know if I understood you correctly.

      If you're connecting to local SQL server, just use '.' instead of hostname or IP address.

      If you intend to use Windows authentication, don't use user and password arguments; instead use trusted=True, as specified in documentation.

      If it hangs, the hostname is probably not what you expect. Add some print statements before pymssql.connect to see if the values pulled up by ipconfig and others are correct.

      Regards,
      Andrzej

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.