hello,
please help!
i am soo frustrated...
what am i doing wrong?
see: https://python-forum.io/misc.php?action=help&hid=25
please help!
i am soo frustrated...
what am i doing wrong?
import pyodbc server = 'SQLEXPRESS' database = 'TSQL2012' username = 'user' password = 'pass' driver= '{ODBC Driver 11 for SQL Server}' cnxn = pyodbc.connect('DRIVER='+driver+';PORT=1433;SERVER='+server+';PORT=1443;DATABASE='+database+';UID='+username+';PWD='+ password) cursor = cnxn.cursor() cursor.execute("select * from [Production].[Categories]") row = cursor.fetchone() if row: print row
Error:C:\Python27\python.exe C:/Users/Papom/PycharmProjects/untitled/ODBC.py
Traceback (most recent call last):
File "C:/Users/Papom/PycharmProjects/untitled/ODBC.py", line 7, in <module>
cnxn = pyodbc.connect('DRIVER='+driver+';PORT=1433;SERVER='+server+';PORT=1443;DATABASE='+database+';UID='+username+';PWD='+ password)
pyodbc.Error: ('08001', '[08001] [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. (53) (SQLDriverConnect); [HYT00] [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired (0); [01S00] [Microsoft][ODBC Driver 11 for SQL Server]Invalid connection string attribute (0); [08001] [Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (53)')
Process finished with exit code 1
Output:[b][u]odbc[/u][/b]
Microsoft ODBC Driver for SQL Server Version 12.00.2000
Running connectivity tests...
Attempting connection
Connection established
Verifying option settings
Disconnecting from server
TESTS COMPLETED SUCCESSFULLY!
Moderator Larz60+: Removed formatting, added tags - Pease read how to post
see: https://python-forum.io/misc.php?action=help&hid=25