ibm System i Access によるDB接続には、unixODBC が必要なので、インストールします。
unixODBCをインストールすることで、postgresのodbcドライバ(※)もインストールされます。
※/usr/lib/libodbcpsql.so , /usr/lib/libodbcpsqlS.so
unixODBCの入手
$ wget http://www.unixodbc.org/unixODBC-2.2.12.tar.gz
install
unixODBC-2.2.12/INSTALL によれば...
If you want to install any of the GUI components, you must have also installed the Qt libraries from http://www.troll.no Version 3 or above is now required.
Qtが必要だとX11も必要になるので、GUIなし( --disable-gui )でインストールします。
$ cd unixODBC-2.2.12 $ ./configure --disable-gui $ make # make install
用意したテストデータ
$ /usr/local/pgsql/bin/psql -U postgres test Welcome to psql 8.3.1, the PostgreSQL interactive terminal. : test=# select * from test; col1 | col2 ----------+---------- Tokyo | Shinjuku Fukuoka | Fukuoka Kanagawa | 横浜 (3 rows)
~/.odbc.ini
unixODBCの設定ファイルには、/usr/local/etc/odbc.ini , /usr/local/etc/odbcinst.ini , ~/.odbc.ini がありますが、個人の設定内容は、.odbc.iniに記述します。
http://www.unixodbc.org/internals.html
[ODBC Data Sources] pg_test = PosrgreSQL ODBC Test [pg_test] Description = ODBC for PostgreSQL Driver = /usr/lib/libodbcpsql.so Setup = /usr/lib/libodbcpsqlS.so Servername = localhost ;Port = 5432 Database = test ;Protocol = 6.4 ;ReadOnly = 0 ;ConnSettings = set client_encoding to euc_jp FileUsage = 1 ;Debug = 1 ;CommLog = 1