0

I am trying to connect to local MS SQL Express Edition. I am using canopy for Python editing.

Code:

import pymssql

conn = pymssql.connect(server='******\SQLEXPRESS',user = 'MEA\*****',password='*****',database='BSEG')

cursor = conn.cursor()

cursor.execute('SELECT * FROM Table')
print(cursor.fetchone())

conn.close()

Error::

pymssql.pyx in pymssql.connect (pymssql.c:10734)()

_mssql.pyx in _mssql.connect (_mssql.c:21821)()

_mssql.pyx in _mssql.MSSQLConnection.init (_mssql.c:5917)()

ValueError: too many values to unpack (expected 2)

2 Answers 2

0

user = 'MEA\*****',password='*****'

MEA\***** seems to be Windows login, in this case you shouldn't pass in any password, your user name is enough, but you also should use Integrated security or Trusted parameter in your connection string

It should be smth like this:

server='******\SQLEXPRESS',Trusted_Connection=yes,database='BSEG'
Sign up to request clarification or add additional context in comments.

2 Comments

Yes I am using windows login. Could you please provide me with the proper connection string.
I updated the answer, also, take a look here: stackoverflow.com/questions/16515420/…
0

In my local machine I only have the sql express instance, then after some tryes I get that server can be just ".". the user that I am using is sa

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.