And here I expose my extreme ignorance. I had thought that W7 came
with its ODBC drivers packaged to ready-to-use. I hadn't tried any
sort of connection with them at all.
I used the ODBC setup in Control Panel, and found that there was
nothing pointed at SQL Server. I created a new one, received an
affirmation that it was working when I clicked the 'test connection'
button, then tried the Py code again. Both:
cnxn = pyodbc.connect('DRIVER={SQL Server Native
Client10.0};SERVER=localhost;DATABASE=testdb;UID=guest')
#####################old code
and
cnxn =
pyodbc.connect('DRIVER={SQL_ODBC};SERVER=localhost;DATABASE=testdb;UID=guest')
################new code with the driver name that I just created
now produce this error message:
File "<pyshell#5>", line 1, in <module>
cnxn =
pyodbc.connect('DRIVER={SQL_ODBC};SERVER=localhost;DATABASE=testdb;UID=guest')
Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified (0)
(SQLDriverConnectW)')
I have a feeling that I'm just not doing some very basic SQLServer/
ODBC setup correctly. Is there a rudimentary walkthrough or tutorial
that I can use? I feel bad using your time for elementary questions
that are likely unrelated to the workings of pyodbc itself.
many thanks