0

i have been trying to connect to SQL Server (I have SQL Server 2014 installed on my machine and SQL Native Client 11.0 32bit as driver) using Python and specifically pyodbc but i did not manage to establish any connection. This is the connection string i am using:

conn = pyodbc.connect('''DRIVER={SQL Server Native Client 11.0}; SERVER=//123.45.678.910; DATABASE=name_database;UID=blabla;PWD=password''')

The error message i am getting is this:

Error: ('08001', '[08001] [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [161]. (161) (SQLDriverConnect)')

Now, is this caused by the fact that both Python (i have version 3.5.1) and pyodbc are 64bit while the SQL Driver is 32bit?

If yes, how do i go about solving this problem? How do i adapt pyodbc to query a 32bit database?

I am experiencing the same problem with Oracle database OraCLient11g32_home1

For your information, my machine runs Anaconda 2.5.0 (64-bit).

Any help would be greatly appreciated.Thank you very much in advance.

1 Answer 1

0

I may be missing something here. Why don't you connect to your Oracle database as a SQL Server linked server (or the other way around) ?

Sign up to request clarification or add additional context in comments.

4 Comments

i am actually unable to query SQL Server so even if i wanted to use your approach i would still not be able to get access the server. I am far from being a database expert but i think the problem is caused by the fact u am running python 64bit while SQL Server is 32bit. i don't know how to adapt pyodbc to make it "32bit-friendly"
Are you able to run 32 bit pyodbc? I don't work in Python, but in most cases, I've found that 32 bit tools are more likely to be able to connect to 64 bit sources than the other way around.
that's interesting. i have been trying to download the 32bit version of pyodbc but did not manage to do so....probably because both python and pyodbc are 64bit. i am actually open to anything....i do not have to use necessarily pyodbc (although i understand is the best tool for this job). i am kind of stuck at the moment
The only other thing I might suggest is installing SQL Server Express (it's free) in a 32 bit environment and make sure that your connection string is correct. They can get very finicky.

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.