1

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?

sers
  • 3,139
  • 3
  • 20
  • 28
  • ok, have been trying to solve this - and my conclusion for now ist, that some libraries don't match ... will try to get some newer PostgreSQL and unixODBC stuff on my server ... – sers Jun 13 '22 at 20:09

2 Answers2

1

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.

0

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);
sers
  • 3,139
  • 3
  • 20
  • 28