pg数据库配置odbc

查看UnixODBC是否安装
rpm -qa | grep unixODBC
查看postgresql-odbc 是否安装
rpm -qa | grep postgresql-odbc
本机环境是arm构架的处理器,到官网下载对应的驱动包https://www.postgresql.org/ftp/odbc/versions/src/
将下载的上传并解压 
tar xvf psqlodbc-11.01.0000.tar.gz
切换到目录  cd psqlodbc-11.01.0000/ 进行安装
./configure
提示如下报错:configure: error: libpq is not installed or libpq is old
原因是没有安装postgresql-devel组件
yum install -y postgresql* gcc*
组件安装之后无报错,继续
make && make install
提示如下报错
安装 ODBC 的开发包解决:
  
     删除解压的驱动包,重新解压安装之后,上述报错问题解决
 
   配置odbc
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
cat /etc/odbc.ini
[postgresql]                     
Description = PostgresSQLODBC            
Driver = PostgreSQL                
Database = postgres                
Servername = localhost            
UserName = postgres                
Password = longrise@123456                
Port = 5432                    
ReadOnly = 0                    
ConnSettings = set client_encoding to UTF8    
连接测试
isql -v postgresql  postgres longrise@123456
  查找该包,将包传到指定目录,登录测试ok
 find / -name psqlodbcw.so
 产看数据库
SELECT datname FROM pg_database WHERE datistemplate = false;
posted @ 2022-03-15 21:11  fangzpa  阅读(1314)  评论(0编辑  收藏  举报