Issue 281: Issue connecting to SQL Server 2008 R2 Express
Status:  NoFix
Owner: ----
Closed:  Aug 2012
Reported by anurag.c...@gmail.com, Aug 9, 2012
What is the expected output? What do you see instead?
======================================================
I cannot connect to my local instance of SQL Server. Here are 2 variations of connection string that i used along with their output

>>> cnxn= pyodbc.connect('DRIVER={SQL Server};SERVER=127.0.0.1;DATABASE=master;UID=guddu;PWD=ABC')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pyodbc.Error: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation. (11) (SQLDriverConnect);[01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (PreLoginHandshake()). (233)')
>>> cnxn= pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=master;UID=guddu;PWD=ABC')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pyodbc.Error: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. (17) (SQLDriverConnect); [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). (52)')
>>>

What version of the product are you using? On what operating system?
====================================================================
pyODBC 3.0.6, Python 2.7, Windows XP, SQL Server 2008 R2 Express
Aug 16, 2012
Project Member #1 mkleehammer
I use pyodbc with SQL Server 2008 R2 daily, so I'm confident it works in general.

There are two common issues I think will answer your question:

1) The first is that SQL Server Express doesn't use the default instance name, so you must provide it as part of the SERVER keyword.  Something like: Server=127.0.0.1\SQLEXPRESS

2) I believe R2 does not enable TCP/IP by default, so make sure you check the SQL Server protocols and enable them.

(And don't forget to check your firewall ;)
Status: NoFix