【Cognos】II-Centos6.8编译安装测试ODBC(32bit)
参考
https://bbs.huaweicloud.com/blogs/235581
准备安装 packages 放入<install-directory>
wget http://www.unixodbc.org/unixODBC-2.3.0.tar.gz
wget https://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.gz --no-check-certificate
wget https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-12.00.0000.tar.gz --no-check-certificate
编译环境准备
yum -y install glibc*.i686 libgcc*.i686 gcc-c++
参考:
https://blog.csdn.net/kongshuai19900505/article/details/82775688
编译安装
准备工作目录
mkdir /usr/local/odbcall
unixODBC
export CODBC_HOME=/usr/local/odbcall/unixodbc
tar zxvf unixODBC-2.3.0.tar.gz
cd unixODBC-2.3.0
./configure CFLAGS="-m32" --prefix=${CODBC_HOME}/
make
make install
PostgreSQL
export CPSQL_HOME=/usr/local/odbcall/pgsql
tar zxvf postgresql-9.2.4.tar.gz
cd postgresql-9.2.4
./configure CFLAGS="-m32" --without-readline --without-zlib --prefix=${CPSQL_HOME}/
make
make install
psqlodbc
export PATH=${CPSQL_HOME}/bin:$PATH
export CPSQLODBC_HOME=/usr/local/odbcall/psqlodbc
tar zxvf psqlodbc-12.00.0000.tar.gz
cd psqlodbc-12.00.0000.tar.gz
./configure CFLAGS="-m32" --prefix=${CPSQLODBC_HOME}/ --with-unixodbc=${CODBC_HOME}/ --with-libpq=${CPSQL_HOME}/
make
make install
配置环境变量(.bashrc)
export CPSQL_HOME=/usr/local/odbcall/pgsql
export CODBC_HOME=/usr/local/odbcall/unixodbc
export CPSQLODBC_HOME=/usr/local/odbcall/psqlodbc
export PATH=${CODBC_HOME}/bin:${CPSQLODBC_HOME}/bin:${CPSQL_HOME}/bin:$PATH
export LD_LIBRARY_PATH=${CODBC_HOME}/lib:${CPSQLODBC_HOME}/lib:${CPSQL_HOME}/lib:$LD_LIBRARY_PATH
export LD_RUN_PATH=${CODBC_HOME}/lib:${CPSQLODBC_HOME}/lib:${CPSQL_HOME}/lib:$LD_RUN_PATH
export ODBCINI=${CODBC_HOME}/etc/odbc.ini
export MAPRDRILLINI=${CODBC_HOME}/etc/.odbc.ini
验证
检查环境变量
[root@localhost local]# odbcinst -j
unixODBC 2.3.0
DRIVERS............: /usr/local/odbcall/unixodbc/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/odbcall/unixodbc/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/odbcall/unixodbc/etc/ODBCDataSources
USER DATA SOURCES..: /usr/local/odbcall/unixodbc/etc/odbc.ini
SQLULEN Size.......: 4
SQLLEN Size........: 4
SQLSETPOSIROW Size.: 2
[root@localhost local]#
配置文件( $ODBCINI )
[root@localhost local]# cat $ODBCINI
[ODB]
Driver = /usr/local/odbcall/psqlodbc/lib/psqlodbcw.so
Description = ODB
Servername = 192.168.56.106
Database = dw
Username = fy
Password = 123456
Port = 5432
ReadOnly = No
ConnSettings = set client_encoding to UTF8
验证
[cognos@cc ~]$ isql ODB
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select now();
+---------------------------+
| now |
+---------------------------+
| 2022-02-25 20:41:46.877361|
+---------------------------+
SQLRowCount returns 1
1 rows fetched
SQL> quit;
问题汇总
/usr/bin/ld: Relocatable linking with relocations from format elf32-i386 (localtime.o) to format elf64-x86-64 (SUBSYS.o) is not supported
https://postgrespro.com/list/thread-id/1708425
export CC="gcc -m32"
export LD="ld -melf_i386"
error: openssl/ssl.h: No such file or directory
yum install openssl-devel
error: opensslconf-i386.h: No such file or directory
将postgresql版本替换成9.2.4