如何从Ubuntu连接到Windows SQL Server [英] How to connect to windows SQL Server from Ubuntu

查看:85
本文介绍了如何从Ubuntu连接到Windows SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的两天里,我一直在尝试连接到远程Windows SQL Server,但没有明显的成功.我正在尝试使用 pyodbc 包与python连接.

For the past two days I have been trying to connect to a remote windows SQL server with no apparent success. I am trying to connect with python using the pyodbc package.

出于这个问题,我尝试过浏览所有博客文章,但没有多大运气.我首先关注了我认为这是一个很好的努力,但最终却因为IMO过于不连贯而告终.

I have tried following all the blog posts out there for that matter without much luck. I first followed that one which I think makes a good effort but ends up being too incoherent IMO.

我已经按照博客文章中的建议安装了 unixODBC 管理器.我已经从Windows下载了可用的redhat软件包并运行了安装脚本,但是每次尝试连接到数据库时,我都会得到

I have installed the unixODBC manager as proposed in the blog post. I have downloaded the available redhat packages from Windows and run the installation scripts but every time I try to connect to the db I get

pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'SQL Server Native Client 10.0' : file not found (0) (SQLDriverConnect)")

是否有办法在几个小时内实现这一目标,而不必自己调整window的安装脚本?有人可以概述需要采取的步骤和需要安装的模块,以便有人可以从linux计算机连接到Windows SQL Server吗?

Is there a way to achieve that in a matter of hours without having to adjust window's installation scripts myself? Can someone provide an overview of the steps that need to be taken and the modules that need to be installed in order for someone to be able to connect to windows SQL server from a linux machine?

我当前正在使用Ubuntu 15.04.

I am currently using Ubuntu 15.04.

更新

我还尝试了此处给出的说明.查看azure平台中SQL db的详细信息,明确指出该驱动程序应为SQL Server Native Client 10.0.我应该考虑强制使用该驱动程序,还是可以按照第二篇博客文章中的建议使用FreeTDS?

I also tried the instructions given here. Looking at the details of the SQL db in the azure platform it is explicitly stated that the driver should be SQL Server Native Client 10.0. Should I consider mandatory using that driver or can I use for example FreeTDS as suggested in the second blog post?

推荐答案

在文件系统上检查名为libsqlncli *的文件.如果找到它,请检查:

check on your filesystem for a file named libsqlncli*. If you'll find it check:

  • 权限
  • 在对此文件执行的ldd命令的输出中,行报告未找到";
  • 如果一切正常,请检查/ddd odncinst.ini文件中的以下条目:

  • permissions
  • rows reporting "NOT FOUND" in the output of the ldd command executed against this file;
  • If all seems to be ok check for/ddd the following entry in your odncinst.ini file:

[SQL Server本机客户端1 [0 | 1] .0]Description =用于Linux的Microsoft SQL Server ODBC驱动程序V1.0驱动程序=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0UsageCount = 1

这篇关于如何从Ubuntu连接到Windows SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆