本文共 2212 字,大约阅读时间需要 7 分钟。
安装驱动
yum install -y unixODBC.x86_64 yum install -y postgresql-odbc.x86_64
查看驱动配置
cat /etc/odbcinst.ini # Example driver definitions# Driver from the postgresql-odbc package# Setup from the unixODBC package[PostgreSQL]Description = ODBC for PostgreSQLDriver = /usr/lib/psqlodbcw.soSetup = /usr/lib/libodbcpsqlS.soDriver64 = /usr/lib64/psqlodbcw.soSetup64 = /usr/lib64/libodbcpsqlS.soFileUsage = 1# Driver from the mysql-connector-odbc package# Setup from the unixODBC package[MySQL]Description = ODBC for MySQLDriver = /usr/lib/libmyodbc5.soSetup = /usr/lib/libodbcmyS.soDriver64 = /usr/lib64/libmyodbc5.soSetup64 = /usr/lib64/libodbcmyS.soFileUsage = 1
配置DSN
/etc/odbc.ini [digoal]Description = Test to PostgresDriver = PostgreSQLDatabase = postgresServername = xxxx.pg.rds.aliyuncs.comUserName = xxxxPassword = xxxxPort = 3433ReadOnly = 0[gp]Description = Test to gpDriver = PostgreSQLDatabase = mygpdbServername = xxxx.gpdb.rds.aliyuncs.comUserName = xxxxPassword = xxxxPort = 3568ReadOnly = 0
测试连通性
echo "select count(*) from pg_class"|isql gp+---------------------------------------+| Connected! || || sql-statement || help [tablename] || quit || |+---------------------------------------+SQL> select count(*) from pg_class+---------------------+| count |+---------------------+| 388 |+---------------------+SQLRowCount returns 11 rows fetchedecho "select count(*) from pg_class"|isql digoal+---------------------------------------+| Connected! || || sql-statement || help [tablename] || quit || |+---------------------------------------+SQL> select count(*) from pg_class+---------------------+| count |+---------------------+| 1330 |+---------------------+SQLRowCount returns 11 rows fetched
参考文档
转载地址:http://uizua.baihongyu.com/