简体   繁体   English

数据库连接SQL Server / Oracle

[英]Database Connection SQL Server / Oracle

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. 我一直在尝试使用Python(特别是pyodbc)连接到SQL Server(我的计算机上安装了SQL Server 2014,并且将SQL Native Client 11.0 32bit作为驱动程序)连接到SQL Server,但是我没有建立任何连接。 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''') conn = pyodbc.connect('''DRIVER = {SQL Server Native Client 11.0};服务器= // 123.45.678.910; DATABASE =名称数据库; UID = blabla; PWD =密码''')

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)') 错误:(“ 08001”,“ [08001] [Microsoft] [SQL Server Native Client 11.0]命名管道提供程序:无法打开与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? 现在,这是否是由于Python(我有3.5.1版)和pyodbc都是64位而SQL驱动程序是32位这一事实引起的?

If yes, how do i go about solving this problem? 如果是,我该如何解决这个问题? How do i adapt pyodbc to query a 32bit database? 我如何适应pyodbc查询32位数据库?

I am experiencing the same problem with Oracle database OraCLient11g32_home1 我在Oracle数据库OraCLient11g32_home1中遇到相同的问题

For your information, my machine runs Anaconda 2.5.0 (64-bit). 供您参考,我的机器运行Anaconda 2.5.0(64位)。

Any help would be greatly appreciated.Thank you very much in advance. 任何帮助将不胜感激。非常感谢您。

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) ? 为什么不以SQL Server链接服务器(或相反)的方式连接到Oracle数据库?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM