Thread: PSQL iODBC driver on mac os x 10.10.3 (Yosemite)

PSQL iODBC driver on mac os x 10.10.3 (Yosemite)

From
Dmitry Pogorelov
Date:
Hi,

I've got postges 9.4 installed on Mac OS X 10.10.3 (Yosemite) I have access to it from psql and I have set up and filled a database I now want to access via ODBC - all on the localhost, no remote access involved. To get the 32 bit PSQL iODBC driver I've run the following command on the latest source code (psqlodbc-09.03.0400.tar.gz): 

./configure CFLAGS="-arch i386 -D ENABLE_MYLOG" --with-iodbc=/usr/local/iODBC --with-libpq=/Library/PostgreSQL/9.4

make

I've also built the latest version (3.52.10) of iODBC (https://github.com/openlink/iODBC) by the instruction from https://github.com/openlink/iODBC/blob/develop/README.MACOSX link (see method 1).

Further I copied the built in first step PSQL iODBC driver to /Library/ODBC/PSQL/bin/iODBC/ folder, I also added all necessaries libs:
1. iODBC from /Library/Frameworks/iODBC.framework/Versions/3.52/iODBC,
2. iODBCinst from /Library/Frameworks/iODBCinst.framework/Versions/3.52/iODBCinst
3. libpq.5.dylib from /Library/PostgreSQL/9.4/lib/libpq.5.7.dylib (renamed it to libpq.5.dylib)
4. libssl.1.0.0.dylib from /usr/local/Cellar/openssl/1.0.2/lib (installed openssl via brew)
 to /Library/ODBC/test/lib folder and changed paths to .dylib in built psql driver by the following commands:

install_name_tool -change libssl.1.0.0.dylib /Library/ODBC/PSQL/lib/libssl.1.0.0.dylib /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so

install_name_tool -change libpq.5.dylib /Library/ODBC/PSQL/lib/libpq.5.dylib /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so

install_name_tool -change /Library/Frameworks/iODBC.framework/Versions/3.52/iODBC /Library/ODBC/PSQL/lib/iODBC /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so

install_name_tool -change /Library/Frameworks/iODBCinst.framework/Versions/3.52/iODBCinst /Library/ODBC/PSQL/lib/iODBCinst /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so

I've also created odbc.ini and odbcinst.ini files in /Library/ODBC folder. The odbc.ini contains:

[ODBC Data Sources]

PSQL_Unicode_32           = PSQL iODBC Driver 32 bit (Unicode)

[PSQL_Unicode_32]

Driver           = /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so

ServerName       = 127.0.0.1

Port             = 5432

Database         = test_tables

Username         = postgres

Password         = sa

UpdatableCursors = false

The odbcinst.ini contains:

[ODBC Drivers]

PSQL iODBC Driver 32 bit (Unicode)            = Installed

[PSQL iODBC Driver 32 bit (Unicode)]

Driver = /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so

Setup  =

In the OpenLink ODBC Administrator I can see the configured odbc driver and the driver also passes test connection.
Further I installed LibreOffice 4.3.7 32 bit to check the PSQL Driver 32 bit. So when I tried to connect to PostgreSQL via PSQL iODBC driver I couldn't get list of tables though sql queries worked correctly (the problem was only in getting of list tables). After that I installed the latest version of Microsoft Excel 2016 on mac (Microsoft Office for mac is supplied as 32 bit so far), when I also tried to connect to PostgreSQL via PSQL iODBC driver the Excel just hanged though on Windows both LibreOffice of the same version and Excel worked correctly. Could you please help me to solve the problem related to LibreOffice (couldn't get list of tables) and Excel 2016?
 
Thank you in advance.

Best Regards
Dmitry Pogorelov

Re: PSQL iODBC driver on mac os x 10.10.3 (Yosemite)

From
Adrian Klaver
Date:
On 08/02/2015 12:13 PM, Dmitry Pogorelov wrote:
> Hi,
>
> I've got postges 9.4 installed on Mac OS X 10.10.3 (Yosemite) I have
> access to it from psql and I have set up and filled a database I now
> want to access via ODBC - all on the localhost, no remote access
> involved. To get the 32 bit PSQL iODBC driver I've run the following
> command on the latest source code (psqlodbc-09.03.0400.tar.gz
> <https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-09.03.0400.tar.gz>):
>
>
> ./configure CFLAGS="-arch i386 -D ENABLE_MYLOG"
> --with-iodbc=/usr/local/iODBC --with-libpq=/Library/PostgreSQL/9.4
>
> make
>
> I've also built the latest version (3.52.10) of iODBC
> (https://github.com/openlink/iODBC) by the instruction from
> https://github.com/openlink/iODBC/blob/develop/README.MACOSX link (see
> method 1).
>
> Further I copied the built in first step PSQL iODBC driver to
> /Library/ODBC/PSQL/bin/iODBC/ folder, I also added all necessaries libs:
> 1. iODBC from /Library/Frameworks/iODBC.framework/Versions/3.52/iODBC,
> 2. iODBCinst from
> /Library/Frameworks/iODBCinst.framework/Versions/3.52/iODBCinst
> 3. libpq.5.dylib from /Library/PostgreSQL/9.4/lib/libpq.5.7.dylib
> (renamed it to libpq.5.dylib)
> 4. libssl.1.0.0.dylib from /usr/local/Cellar/openssl/1.0.2/lib
> (installed openssl via brew)
>   to /Library/ODBC/test/lib folder and changed paths to .dylib in built
> psql driver by the following commands:
>
> install_name_tool -change libssl.1.0.0.dylib
> /Library/ODBC/PSQL/lib/libssl.1.0.0.dylib
> /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so
>
> install_name_tool -change libpq.5.dylib
> /Library/ODBC/PSQL/lib/libpq.5.dylib
> /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so
>
> install_name_tool -change
> /Library/Frameworks/iODBC.framework/Versions/3.52/iODBC
> /Library/ODBC/PSQL/lib/iODBC /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so
>
> install_name_tool -change
> /Library/Frameworks/iODBCinst.framework/Versions/3.52/iODBCinst
> /Library/ODBC/PSQL/lib/iODBCinst /Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so
>
> I've also created odbc.ini and odbcinst.ini files in /Library/ODBC
> folder. The odbc.ini contains:
>
> [ODBC Data Sources]
>
> PSQL_Unicode_32 =PSQL iODBC Driver 32 bit (Unicode)
>
> [PSQL_Unicode_32]
>
> Driver =/Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so
>
> ServerName =127.0.0.1
>
> Port =5432
>
> Database =test_tables
>
> Username =postgres
>
> Password =sa
>
> UpdatableCursors =false
>
> The odbcinst.ini contains:
>
> [ODBC Drivers]
>
> PSQL iODBC Driver 32 bit (Unicode) =Installed
>
> [PSQL iODBC Driver 32 bit (Unicode)]
>
> Driver =/Library/ODBC/PSQL/bin/iODBC/psqlodbcw.so
>
> Setup =
>
> In the OpenLink ODBC Administrator I can see the configured odbc driver
> and the driver also passes test connection.
> Further I installed LibreOffice 4.3.7 32 bit to check the PSQL Driver 32
> bit. So when I tried to connect to PostgreSQL via PSQL iODBC driver I
> couldn't get list of tables though sql queries worked correctly (the
> problem was only in getting of list tables). After that I installed the
> latest version of Microsoft Excel 2016 on mac (Microsoft Office for mac
> is supplied as 32 bit so far), when I also tried to connect to
> PostgreSQL via PSQL iODBC driver the Excel just hanged though on Windows
> both LibreOffice of the same version and Excel worked correctly. Could
> you please help me to solve the problem related to LibreOffice (couldn't
> get list of tables) and Excel 2016?
> Thank you in advance.

All I can think to do is enable MyLog and/or CommLog:

https://odbc.postgresql.org/docs/config.html

and see what happens when you use LO or Excel. FYI, logging in
particular MyLog, will really slow things down.

>
> Best Regards
> Dmitry Pogorelov


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: PSQL iODBC driver on mac os x 10.10.3 (Yosemite)

From
Adrian Klaver
Date:
On 02/10/2016 02:18 PM, Dmitry Pogorelov wrote:
> Hi,
>
> Sorry for the too late answer but at last I could get free time for the
> issue. Still I have the problem related to not shown table list in
> LibreOffice. I've built the latest version of 32/64 bit postgresql odbc
> driver (09.05.0100) but already under El Capitan OS X (10.11.3) with
> iODBC 3.52. I've tried to use the driver by different versions of 32 bit
> LibreOffice - didn't help. I turned on mylog and got logs (attached).
> There was just only one "test_table" table with one "a" column. In
> LibreOffice in tables I saw only empty list, without any tables.

I gave up on LO/OO Base as a database frontend some time ago as it's
performance was spotty at best. I do remember that LO/OO was finicky
about there being a primary key on a table.

Does the table you mention have a primary key?

>
> Best Regards,
> Dmitry
>
> Best Regards
> Dmitry Pogorelov
>

>
>
>     All I can think to do is enable MyLog and/or CommLog:
>
>     https://odbc.postgresql.org/docs/config.html
>
>     and see what happens when you use LO or Excel. FYI, logging in
>     particular MyLog, will really slow things down.
>
>
>         Best Regards
>         Dmitry Pogorelov
>
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Fwd: PSQL iODBC driver on mac os x 10.10.3 (Yosemite)

From
Dmitry Pogorelov
Date:

Best Regards
Dmitry Pogorelov

---------- Forwarded message ----------
From: Dmitry Pogorelov <dalex005@gmail.com>
Date: 2016-02-11 0:54 GMT+01:00
Subject: Re: [ODBC] PSQL iODBC driver on mac os x 10.10.3 (Yosemite)
To: Adrian Klaver <adrian.klaver@aklaver.com>


I've just run the following scripts:

delete from test_table;

ALTER TABLE test_table
   ADD COLUMN id integer;

ALTER TABLE test_table
   ADD PRIMARY KEY (id);

insert into test_table (id, a) values (1, 1);

It didn't help, I have the empty table's list yet on LO. New log is attached. You know, when I compared the mylogs I noticed a difference in sequence of methods' calls after SQLTables function. On windows: SQLGetInfoW, SQLNumResultCols, several calls of SQLColAttributeW, several calls of SQLBindCol and only after that SQLFetch, on OS X: SQLNumResultCols, SQLFetch messed with SQLColAttributeW, SQLGetData. I don't know maybe it's related to iODBC, maybe not.

Best Regards
Dmitry Pogorelov

2016-02-11 0:34 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:
On 02/10/2016 03:34 PM, Dmitry Pogorelov wrote:
Hi Adrian,

No, just a simple test table, without a primary key. I used the script:

CREATE TABLE test_table
(
   a integer
)
WITH (
   OIDS=FALSE
);
ALTER TABLE test_table
   OWNER TO postgres;

So what happens if you add a primary key?


Best Regards
Dmitry Pogorelov

2016-02-11 0:28 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com
<mailto:adrian.klaver@aklaver.com>>:


    On 02/10/2016 02:18 PM, Dmitry Pogorelov wrote:

        Hi,

        Sorry for the too late answer but at last I could get free time
        for the
        issue. Still I have the problem related to not shown table list in
        LibreOffice. I've built the latest version of 32/64 bit
        postgresql odbc
        driver (09.05.0100) but already under El Capitan OS X (10.11.3) with
        iODBC 3.52. I've tried to use the driver by different versions
        of 32 bit
        LibreOffice - didn't help. I turned on mylog and got logs
        (attached).
        There was just only one "test_table" table with one "a" column. In
        LibreOffice in tables I saw only empty list, without any tables.


    I gave up on LO/OO Base as a database frontend some time ago as it's
    performance was spotty at best. I do remember that LO/OO was finicky
    about there being a primary key on a table.

    Does the table you mention have a primary key?


        Best Regards,
        Dmitry

        Best Regards
        Dmitry Pogorelov




             All I can think to do is enable MyLog and/or CommLog:

        https://odbc.postgresql.org/docs/config.html

             and see what happens when you use LO or Excel. FYI, logging in
             particular MyLog, will really slow things down.


                 Best Regards
                 Dmitry Pogorelov



             --
             Adrian Klaver
        adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
        <mailto:adrian.klaver@aklaver.com
        <mailto:adrian.klaver@aklaver.com>>




    --
    Adrian Klaver
    adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>




--
Adrian Klaver
adrian.klaver@aklaver.com


Attachment