如何在 Ubuntu 12.10 中安装 iodbc

如何在 Ubuntu 12.10 中安装 iodbc

我需要在我的 Quantal 机器上安装库 iodbc(依赖于 libodbc2)。但是存在令人毛骨悚然的依赖性问题。它不知怎么被 unixodbc 取代了,而我没有安装。这是我尝试安装时得到的结果:

安装 iodbc 失败

sudo apt-get install libiodbc2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
 libiodbc2-dev : Depends: libiodbc2 (= 3.52.7-2build2) but it is not going to be installed
                 Depends: iodbc (= 3.52.7-2build2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我可以看出 iodbc 与 odbcinst 冲突。但是,由于以下原因,我无法删除它:

sudo apt-get remove odbcinst
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  akonadi-backend-mysql calligra-l10n-engb kde-l10n-engb kdevelop-l10n kdevelop-php-docs-l10n kdevelop-php-l10n libakonadi-kabc4 libakonadi-notes4
  libakonadiprotocolinternals1 libboost-thread1.49.0 libdmtx0a libgpgme++2 libkcalcore4 libkdgantt2 libkholidays4 libkimap4 libkldap4 libkmbox4 libkmime4
  libkolabxml0 libkpgp4 libkresources4 libksieve4 libprison0 libqgpgme1 libqrencode3 libxerces-c3.1
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  akonadi-server k3b k3b-i18n katepart kde-runtime kdelibs-bin kdelibs5-plugins kdepim-runtime kdepim-strigi-plugins kdepimlibs-kio-plugins kdoctools kget kmag
  kmail kmix kmousetool ksystemlog kubuntu-debug-installer language-pack-kde-ar language-pack-kde-en libakonadi-calendar4 libakonadi-contact4 libakonadi-kcal4
  libakonadi-kde4 libakonadi-kmime4 libcalendarsupport4 libincidenceeditorsng4 libk3b6 libkabc4 libkactivities-bin libkactivities6 libkalarmcal2
  libkatepartinterfaces4 libkcal4 libkcalutils4 libkcddb4 libkde3support4 libkdepim4 libkdepimdbusinterfaces4 libkdewebkit5 libkemoticons4 libkfile4 libkgapi0
  libkhtml5 libkio5 libkleo4 libkmanagesieve4 libkmediaplayer4 libknewstuff3-4 libknotifyconfig4 libkolab0 libkonq-common libkonq5abi1 libkontactinterface4
  libkparts4 libkpimidentities4 libkpimtextedit4 libkpimutils4 libkprintutils4 libksieveui4 libktexteditor4 libktnef4 libktorrent4 libkworkspace4abi2
  libkxmlrpcclient4 libmailcommon4 libmailimporter4 libmailtransport4 libmessagecomposer4 libmessagecore4 libmessagelist4 libmessageviewer4 libmicroblog4
  libnepomuk4 libnepomukcore4abi1 libnepomukquery4a libnepomuksync4 libnepomukutils4 libplasma3 libsoprano4 libtemplateparser4 libvirtodbc0 nepomuk-core odbcinst
  odbcinst1debian2 plasma-scriptengine-javascript qapt-batch soprano-daemon virtuoso-minimal
0 upgraded, 0 newly installed, 89 to remove and 0 not upgraded.
After this operation, 126 MB disk space will be freed.
Do you want to continue [Y/n]?

odbcins 卸载失败 其他信息:为什么“iodbc”和“libmyodbc”包相互冲突?

根本问题是我需要使用最新 MySQL Workbench 版本 (DB Migration) 中引入的新功能,该功能使用 odbc。以下是 Mysql 文档对此的说明:

Linux

迁移向导使用 iODBC 作为 Linux 中所有 ODBC 连接的驱动程序管理器。这可能会给您带来一些麻烦,因为大多数 Linux 发行版都提供针对 unixODBC 编译的 ODBC 驱动程序。这是 MySQL Workbench 不支持的另一个驱动程序管理器,因此除非您针对 iODBC 编译它们,否则您将无法使用这些驱动程序。以下是您应该做的事情。

确保已安装 iODBC。如果您使用的是 Debian、Ubuntu 或其他基于 Debian 的发行版,请在终端中输入此命令:

$> sudo apt-get install iodbc libiodbc2-dev libpq-dev libssl-dev

对于基于 RPM 的发行版(RedHat、Fedora 等),请键入此命令而不是上一个命令:

$> sudo yum 安装 iodbc iodbc-dev libpqxx-devel openssl-devel

现在我们需要安装 PostgreSQL ODBC 驱动程序。

从此处下载 psqlODBC 源 tarball。使用可下载的最新版本。截至撰写本文时,最新版本对应于文件 psqlodbc-09.01.0200.tar.gz。将此 tarball 解压到硬盘驱动器中的目录,然后打开终端并进入该目录。

在终端窗口中输入以下内容:

$> ./configure --with-iodbc --enable-pthreads $> make $> sudo make install

验证 /usr/local/lib 目录中是否有文件 psqlodbcw.so。

这个包似乎可能存在问题:

dpkg -s odbcinst1debian2
Package: odbcinst1debian2
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 241
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Multi-Arch: same
Source: unixodbc
Version: 2.2.14p2-5ubuntu4
Replaces: unixodbc (<< 2.1.1-2)
Depends: libc6 (>= 2.14), libltdl7 (>= 2.4.2), odbcinst
Pre-Depends: multiarch-support
Breaks: libiodbc2, libmyodbc (<< 5.1.6-2), odbc-postgresql (<< 1:09.00.0310-1.1), tdsodbc (<< 0.82-8)
Conflicts: odbcinst1, odbcinst1debian1
Description: Support library for accessing odbc ini files
 This package contains the libodbcinst library from unixodbc, a library
 used by ODBC drivers for reading their configuration settings from
 /etc/odbc.ini and ~/.odbc.ini.
 .
 Also contained in this package are the driver setup plugins, which
 describe the features supported by individual ODBC drivers.
Homepage: http://www.unixodbc.org/
Original-Maintainer: Steve Langasek <[email protected]>

我没有破损的包裹: 无破损包装

答案1

一些 Linux 发行版(Debian、Ubuntu、Gentoo)有自己的 iODBC 包,因此你只需要输入如下命令:

sudo apt-get install libiodbc2 iodbc  

自动安装它以及可能的一些依赖项(管理员实用程序的 GTK+ 库)。

参考 :http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/IODBCRubyHOWTO#Linux

I ended up installing just libmyodbc and configuring odbc using the /etc/odbc.ini file:

    [ODBC Data Sources]
    odbcname = MyODBC 3.51 Driver DSN

    [the_db]
    Driver = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
    Description = The Database using MyODBC 3.51 Driver DSN
    SERVER = localhost
    PORT =
    USER = root
    Password = someOldPassword
    Database = the_db
    OPTION = 3
    SOCKET =

相关内容