第一步 `apt install -y unixodbc`
第二步下载 dws_8.2.x_odbc_driver_for_x86_redhat.zip 到 /tmp,之后
```
cd /tmp
unzip dws_8.2.x_odbc_driver_for_x86_redhat.zip
cp lib/* /usr/local/lib
cp odbc/lib/* /usr/local/lib
echo '/usr/local/lib' >> /etc/ld.so.conf
ldconfig
rm -rf lib odbc
```
第三步配置
编辑 /etc/odbcinst.ini
[DWS]
Driver64=/usr/local/lib/psqlodbcw.so
编辑 /etc/odbc.ini
[DWSODBC]
Driver=DWS
Servername=xx
Database=xx
Username=xx
Password=xx
Port=8005
Sslmode=allow
最后测试一把:
isql -v DWSODBC
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| echo [string] |
| quit |
| |
+---------------------------------------+
SQL> select 1;
+------------+
| ?column? |
+------------+
| 1 |
+------------+
SQLRowCount returns 1
1 rows fetched
SQL>
或者试试 `select version();`
在这里下载:
https://dws.obs.myhuaweicloud.com/download/dws_8.2.x_odbc_driver_for_x86_redhat.zip
另外,是否跟 PostgreSQL 的驱动程序有冲突?请知情者告知下,感谢!
参考资料:
https://support.huaweicloud.com/mgtg-dws/dws_01_0086.html
odbc 的配置请参考这里:
https://docs.opengauss.org/zh/docs/3.0.0/docs/BriefTutorial/ODBC.html
还有这个:
https://support.huaweicloud.com/distributed-devg-v8-gaussdb/gaussdb-12-1819.html