【问题标题】:Unable to connect Microsoft SQL-Server and Visual Studio code无法连接 Microsoft SQL-Server 和 Visual Studio 代码
【发布时间】:2019-03-06 10:48:13
【问题描述】:

我刚刚在我的 Ubuntu 18.10 机器上安装了适用于 linux 的 MSSQL 2017 和适用于 linux 的 Visual Studio 代码。 两者都安装成功,但我无法从 Visual Studio 连接到数据库。

我有以下正在运行的驱动程序:

$ 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 install 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.

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

有没有人正在运行的解决方案?

【问题讨论】:

  • 不确定,但我认为 ODBC/ADO 需要在 wine 下运行。
  • 好吧,我也不确定!所有文档实际文档从不谈论 Wine 或其他层。并且看起来他们不需要这些层。我发现了一个特定的警报:Note At this time, the Windows Subsystem for Linux for Windows 10 is not supported as an installation target.

标签: sql-server visual-studio-code ubuntu-18.04 sql-server-2017


【解决方案1】:

如果您计划进行 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    • 2010-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多