要在Ubuntu上下载ODBC驱动程序,请按照以下步骤进行操作:
sudo apt-get update
sudo apt-get install unixodbc
sudo apt-get install unixodbc-dev
下载适用于你需要使用的数据库的ODBC驱动程序。你需要从相应的数据库供应商处获取这个驱动程序。例如,如果你需要连接到MySQL数据库,则需要下载MySQL的ODBC驱动程序。
sudo apt-get install libmyodbc
sudo apt-get install odbc-postgresql
MySQL:
sudo apt install libmyodbc
达梦数据库:
SQL Server:
Oracle:
SQLite:
下载完odbc需要配置dsn连接才能成功连接数据库
[root@localhost ~]# cat /etc/odbcinst.ini
[PostgreSQL]
Description=ODBC for PostgreSQL
Driver=/usr/lib/psqlodbcw.so
Setup=/usr/lib/libodbcpsqlS.so
Driver64=/usr/lib64/psqlodbcw.so
Setup64=/usr/lib64/libodbcpsqlS.so
FileUsage=1
[MySQL]
Description=ODBC for MySQL
Driver=/usr/lib/libmyodbc5.so
Setup=/usr/lib/libodbcmyS.so
Driver64=/usr/lib64/libmyodbc5.so
Setup64=/usr/lib64/libodbcmyS.so
FileUsage=1
[ORAC12c]
Description=Oracle ODBC driver for Oracle 12c
Driver=/usr/local/oracle/instantclient_12_1/libsqora.so.12.1
Setup=
FileUsage=
CPTimeout=
CPReuse=
[---DM8 ODBC DRIVER]
Description=DM ODBC DRIVER FOR DM8
Driver=/opt/dmdbms/bin
[MySQL ODBC 8.1 Unicode Driver]
DRIVER=/usr/lib64/libmyodbc8w.so
UsageCount=1
[MySQL ODBC 8.1 ANSI Driver]
DRIVER=/usr/lib64/libmyodbc8a.so
UsageCount=1
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.10.so.4.1
UsageCount=1
[DM8 ODBC DRIVER]
Description = DM ODBC DRIVER FOR DM8
Driver = /opt/dmdbms/bin/libdodbc.so
root@2df9dd5db3da:~# cat /etc/odbc.ini
[DM8_DB]
DRIVER = DM8 ODBC DRIVER
SERVER = 192.168.0.159
UID = ROOT
PWD = ABCDEFG
TCP_PORT = 8080
isql DM8_DB