在CentOS 7上编译PSQLODBC给我连接错误。C-未确定的标识符

发布于 2025-02-05 18:54:50 字数 2658 浏览 4 评论 0 原文

所以我又陷入了困境。

我想做的是:通过oracle访问postgresql数据库(12.1-是的,我知道它是旧的...)。
Oracle在CentOS 7上运行。

最初我做了A,

yum -y install postgresql-odbc   
yum -y install unixODBC

并且能够访问PostgreSQL(在另一台计算机上运行)。

但这对UTF-8数据不起作用。有人提示这可能是由于UnixoDBC的旧版本所致,因此我决定从源头进行编译(因为Centos软件包相当旧)。

编译和安装UnixODBC无需麻烦工作:

wget http://www.unixodbc.org/unixODBC-2.3.11.tar.gz 
tar xzf unixODBC-2.3.11.tar.gz  
cd unixODBC-2.3.11/ 
./configure 
make 
make install

但是编译psqlodbc是它所在的位置:

yum install postgresql
yum install postgresql-devel

wget https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-13.02.0000.tar.gz 
cd psqlodbc-13.02.0000/
./configure 
make
...

MAKE给我以下输出:

[root@tukanbox psqlodbc-13.02.0000]# make
make  all-am
make[1]: Entering directory `/root/psqlodbc-13.02.0000'
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.   -I/usr/local/include -I/usr/include -I/usr/include/pgsql/internal -DUNICODE_SUPPORT  -g -O2 -Wall -MT psqlodbcw_la-connection.lo -MD -MP -MF .deps/psqlodbcw_la-connection.Tpo -c -o psqlodbcw_la-connection.lo `test -f 'connection.c' || echo './'`connection.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -I/usr/include -I/usr/include/pgsql/internal -DUNICODE_SUPPORT -g -O2 -Wall -MT psqlodbcw_la-connection.lo -MD -MP -MF .deps/psqlodbcw_la-connection.Tpo -c connection.c  -fPIC -DPIC -o .libs/psqlodbcw_la-connection.o
connection.c: In function 'handle_pgres_error':
connection.c:900:45: error: 'PG_DIAG_SCHEMA_NAME' undeclared (first use in this function)
   errschemaname = PQresultErrorField(pgres, PG_DIAG_SCHEMA_NAME);
                                             ^
connection.c:900:45: note: each undeclared identifier is reported only once for each function it appears in
connection.c:901:44: error: 'PG_DIAG_TABLE_NAME' undeclared (first use in this function)
   errtablename = PQresultErrorField(pgres, PG_DIAG_TABLE_NAME);
                                            ^
connection.c:902:45: error: 'PG_DIAG_COLUMN_NAME' undeclared (first use in this function)
   errcolumnname = PQresultErrorField(pgres, PG_DIAG_COLUMN_NAME);
                                             ^
connection.c:903:47: error: 'PG_DIAG_DATATYPE_NAME' undeclared (first use in this function)
   errdatatypename = PQresultErrorField(pgres, PG_DIAG_DATATYPE_NAME);
                                               ^
make[1]: *** [psqlodbcw_la-connection.lo] Fehler 1
make[1]: Leaving directory `/root/psqlodbc-13.02.0000'
make: *** [all] Fehler 2

想知道在哪里声明这些未宣布的iDenifiers。它想在这里知道什么?如何解决?

So i'm stuck again.

What I want to do: access a postgreSQL database via database link from Oracle (12.1 - yes, I know it's old ...).
Oracle is running on Centos 7.

Initially I did a

yum -y install postgresql-odbc   
yum -y install unixODBC

and was able to access postgreSQL (running on another machine).

But it didn't work for UTF-8 data. Got a hint that this might be due to an old version of unixODBC so I decided to compile from source (as the centos package is rather old).

Compiling and installing unixODBC worked without a hassle:

wget http://www.unixodbc.org/unixODBC-2.3.11.tar.gz 
tar xzf unixODBC-2.3.11.tar.gz  
cd unixODBC-2.3.11/ 
./configure 
make 
make install

But compiling psqlODBC is where it's at:

yum install postgresql
yum install postgresql-devel

wget https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-13.02.0000.tar.gz 
cd psqlodbc-13.02.0000/
./configure 
make
...

Make gives me the following output:

[root@tukanbox psqlodbc-13.02.0000]# make
make  all-am
make[1]: Entering directory `/root/psqlodbc-13.02.0000'
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.   -I/usr/local/include -I/usr/include -I/usr/include/pgsql/internal -DUNICODE_SUPPORT  -g -O2 -Wall -MT psqlodbcw_la-connection.lo -MD -MP -MF .deps/psqlodbcw_la-connection.Tpo -c -o psqlodbcw_la-connection.lo `test -f 'connection.c' || echo './'`connection.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -I/usr/include -I/usr/include/pgsql/internal -DUNICODE_SUPPORT -g -O2 -Wall -MT psqlodbcw_la-connection.lo -MD -MP -MF .deps/psqlodbcw_la-connection.Tpo -c connection.c  -fPIC -DPIC -o .libs/psqlodbcw_la-connection.o
connection.c: In function 'handle_pgres_error':
connection.c:900:45: error: 'PG_DIAG_SCHEMA_NAME' undeclared (first use in this function)
   errschemaname = PQresultErrorField(pgres, PG_DIAG_SCHEMA_NAME);
                                             ^
connection.c:900:45: note: each undeclared identifier is reported only once for each function it appears in
connection.c:901:44: error: 'PG_DIAG_TABLE_NAME' undeclared (first use in this function)
   errtablename = PQresultErrorField(pgres, PG_DIAG_TABLE_NAME);
                                            ^
connection.c:902:45: error: 'PG_DIAG_COLUMN_NAME' undeclared (first use in this function)
   errcolumnname = PQresultErrorField(pgres, PG_DIAG_COLUMN_NAME);
                                             ^
connection.c:903:47: error: 'PG_DIAG_DATATYPE_NAME' undeclared (first use in this function)
   errdatatypename = PQresultErrorField(pgres, PG_DIAG_DATATYPE_NAME);
                                               ^
make[1]: *** [psqlodbcw_la-connection.lo] Fehler 1
make[1]: Leaving directory `/root/psqlodbc-13.02.0000'
make: *** [all] Fehler 2

Wondering where to declare these undeclared idenifiers. What does it want to know here? How to solve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜味拾荒者 2025-02-12 18:54:52

我面临同一问题,它与软件包版本有关,您必须使用OS版本支持的版本。例如,我的操作系统是RHEL 7.9,因此我必须更新的版本为09.06,比引起该问题的版本更新版本。

I was facing the same issue, it was related of the package version, you must use the one supported by your OS version. For example my OS is RHEL 7.9 so the must updated version for me is 09.06, newer versions than that one was causing that issue.

晒暮凉 2025-02-12 18:54:52

没有回答无法编译的问题的答案 - 但是原始软件包对UTF8不起作用的原始问题的答案:

https://www.postgresql.org/message-id/OFA166DBFD.19742AF7-ONC1257B6A.005692E6-C1257B6A.0056F890@lladro. net

必须在数据库中作为sysdba完成:

select fds_class_name from HS_FDS_CLASS;
select * from hs_class_caps where upper(CAP_DESCRIPTION) like '%NCHAR%' and FDS_CLASS_NAME ='ODBC12.1.0.1.0_0017';
exec DBMS_HS.ALTER_CLASS_CAPS('ODBC12.1.0.1.0_0017' , 564, 'ODBC12.1.0.1.0_0017', 564,131071, NULL, NULL);

No answer to the problem of not being able to compile - but an answer to the original problem that the original packages didn't work for UTF8:

https://www.postgresql.org/message-id/OFA166DBFD.19742AF7-ONC1257B6A.005692E6-C1257B6A.0056F890@lladro.net

This has to be done in the database as sysdba:

select fds_class_name from HS_FDS_CLASS;
select * from hs_class_caps where upper(CAP_DESCRIPTION) like '%NCHAR%' and FDS_CLASS_NAME ='ODBC12.1.0.1.0_0017';
exec DBMS_HS.ALTER_CLASS_CAPS('ODBC12.1.0.1.0_0017' , 564, 'ODBC12.1.0.1.0_0017', 564,131071, NULL, NULL);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文