Environment: SuSE 11, 64-bit operating system
UnixODBC version: 2.3.2
PostgreSQL 9.3.4
1 Compiling and installing UnixODBC
Download UnixODBC:http://www.unixodbc.org/download.html
Unzip the compilation
tar -zxvf unixodbc-2.3. 2. Tar . GZ CD UnixODBC-2.3. 2 . /configure--PREFIX=/OPT/UNIXODBC
Make Make Install
Installation path set in /opt/unixodbc
2 Download the ODBC RPM package for PostgreSQL
:http://rpm.pbone.net/index.php3/stat/4/idpl/23893919/dir/opensuse_11.x/com/unixODBC-2.2.12-200.123.1.x86_ 64.rpm.html
Of course, there are many other system versions of PostgreSQL ODBC driver,http://rpm.pbone.net/index.php3/stat/3/srodzaj/1/search/libodbcpsqlS.so.1% 28%29%2864bit%29
3 Install download RPM package
RPM-IVH unixodbc-2.2. -200.123. 1. x86_64.rpm
If a dependent RPM is not installed at the time of installation, you can override the default rpm and forcibly install this rpm
RPM-IVH--nodeps unixodbc-2.2. -200.123. 1. x86_64.rpm
After installation, the driver should be in /usr/lib64/unixodbc
You can find it yourself by hand and check where ODBC drives are stored
Find " *odbc*.so* " grep Psql
The way I show it is
/usr/lib64/unixodbc/libodbcpsqls.so
/usr/lib64/unixodbc/libodbcpsql.so
PostgreSQL situation
PostgreSQL version is 9.3.4, the database is Foo, the user is sdbadmin, the service port is 5432
There are two tables in PostgreSQL, one is the table test of PostgreSQL itself;
One is PostgreSQL external table Chen, docking is sequoiadb data source (how to achieve PostgreSQL docking sequoiadb, can refer to:http://www.sequoiadb.com/index.php? p=whitepaper_7)
4 Configuring the Unixodbc to fit the PostgreSQL service
Modify the Odbcinst.ini file
VI /opt/unixodbc/etc/odbcinst.ini
Odbcinst.ini
==/opt/unixodbc/2for =/usr/lib64/unixodbc/=/usr/ lib64/unixodbc/1552
Configuring the Odbc.ini File
VI /opt/unixodbc/etc/odbc.ini
Odbc.ini
= = =192.168. 1.155 =5432= No
Load configuration file
/opt/unixodbc/bin/odbcinst-i-d-f/opt/unixodbc/etc/odbcinst.ini
5 starting ODBC for connection testing
/opt/unixodbc/bin/isql-v Postgres
Querying the Test table and Chen table
To be able to find out the data successfully.
Reference blog:
Http://www.unixodbc.org/odbcinst.html
http://linux.vbird.org/linux_basic/0520rpm_and_srpm.php
Linux builds Unixodbc, and docking PostgreSQL 9.3.4