无法连接Microsoft SQL-Server和Visual Studio代码



i刚刚在我的Ubuntu 18.10机器上安装了Linux和Linux的Linux和Visual Studio代码的MSSQL 2017。两个安装都成功了,但是我无法从视觉工作室连接到DB。

我有以下运行驱动程序:

$ odbcinst -j

    unixODBC 2.3.7
    DRIVERS............: /etc/odbcinst.ini
    SYSTEM DATA SOURCES: /etc/odbc.ini
    FILE DATA SOURCES..: /etc/ODBCDataSources
    USER DATA SOURCES..: /home/neo4j/.odbc.ini
    SQLULEN Size.......: 8
    SQLLEN Size........: 8
    SQLSETPOSIROW Size.: 8

但是,当我尝试安装

$ sudo apt-get安装mssql-tools unixodbc-dev

我收到以下错误:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 mssql-tools : Depends: msodbcsql17 (>= 17.3.0.0) but it is not going to be installed
               Depends: msodbcsql17 (< 17.4.0.0) but it is not going to be installed
 unixodbc-dev : Depends: unixodbc (= 2.3.7)
E: Unable to correct problems, you have held broken packages.

经过大量谷歌搜索后,我发现了很多建议,但是它们没有运行,例如尝试删除msodbcsql和unixodbc

$ sudo apt-get remove msodbcsql

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'msodbcsql' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

此时我被锁定了,无法继续。

有人有些运行的解决方案吗?

如果您打算进行UnixODBC-DEV开发(数据库连接不需要),则只需要UnixODBC-DEV。我猜你可以省略它以避免在这里混淆。

和MSODBCSQL和MSODBCSQL17是不同的软件包。MSODBCSQL(SQL Server的MS ODBC驱动程序13)在Ubuntu 18.10上甚至都不可用。

问题的关键是错误消息:

e:无法纠正问题,您的包裹损坏了。

您需要删除损坏的包装上的保留。首先,我会尝试专门安装MSODBCSQL17:

sudo apt-get install msodbcsql17

如果您仍然遇到错误,则可以采取其他步骤来尝试解决持有软件包的问题:https://askubuntu.com/a/223267

最新更新