BlueXIII's Blog

热爱技术,持续学习

0%

UnixODBC安装

macOS下brew方式安装

1
2
3
4
5
6
7
8
9
10
# 安装unixodbc
brew install unixodbc

# 查看配置文件位置
odbcinst -j
unixODBC 2.3.7
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /Users/yourname/.odbc.ini

OdbcManager图形界面

http://www.odbcmanager.net/

postgres驱动

https://odbc.postgresql.org/
https://blogs.sap.com/2015/01/22/%E6%80%8E%E6%A0%B7%E5%9C%A8linux%E4%B8%AD%E9%85%8D%E7%BD%AEpostgre-sql-odbc%E8%BF%9E%E6%8E%A5/

1
2
3
4
# 源码编译安装
./configure
make && make install

odbcinst.ini配置

1
2
3
4
5
6
7
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/local/lib/psqlodbcw.so
Setup = /usr/local/lib/psqlodbca.so
Driver64 = /usr/local/lib/psqlodbcw.so
Setup64 = /usr/local/lib/psqlodbca.so
FileUsage = 1

odbc.ini配置

1
2
3
4
5
6
7
8
9
10
[PostgreSQL35W]
Description = Test to pg
Driver = PostgreSQL
Database = gbdb
Servername = 127.0.0.1
UserName = postgres
Password = postgres
Port = 5432
ReadOnly = 0
ConnSettings = set client_encoding to UTF8