Обсуждение: Re: ODBC constructs

Поиск
Список
Период
Сортировка

Re: ODBC constructs

От
Dev Kumkar
Дата:
Hello,

My objective is to work with postgres from my linux box using C. Am not sure whether psqlODBC or libpq should be used.
I was playing and used libpq successfully but not sure which route to go and whats the difference.

Also Can you please let me know any mapping document which maps ODBC constructs between sybase and postgres.

Also list of ODBC constructs to be used with postgres.

Thanks in advance!

Regards...

p.s. Am not sure if the earlier email was sent..sorry for spam in case it was.


On Mon, May 20, 2013 at 5:37 PM, Dev Kumkar <devdas.kumkar@gmail.com> wrote:
Hello,

My objective is to work with postgres from my linux box using C. Am not sure whether psqlODBC or libpq should be used.
I was playing and used libpq successfully but not sure which route to go and whats the difference.

Also Can you please let me know any mapping document which maps ODBC constructs between sybase and postgres.

Also list of ODBC constructs to be used with postgres.

Thanks in advance!

Regards...

p.s. Am not sure if the earlier email was sent..sorry for spam in case it was.

Re: ODBC constructs

От
Dev Kumkar
Дата:
Also adding the pgsql-admin alias.

Regards...

Re: ODBC constructs

От
Atri Sharma
Дата:


Sent from my iPad

On 21-May-2013, at 6:15, Dev Kumkar <devdas.kumkar@gmail.com> wrote:

Hello,

My objective is to work with postgres from my linux box using C. Am not sure whether psqlODBC or libpq should be used.
I was playing and used libpq successfully but not sure which route to go and whats the difference.

Also Can you please let me know any mapping document which maps ODBC constructs between sybase and postgres.

Also list of ODBC constructs to be used with postgres.

Thanks in advance!

Regards...

p.s. Am not sure if the earlier email was sent..sorry for spam in case it was.


On Mon, May 20, 2013 at 5:37 PM, Dev Kumkar <devdas.kumkar@gmail.com> wrote:
Hello,

My objective is to work with postgres from my linux box using C. Am not sure whether psqlODBC or libpq should be used.
I was playing and used libpq successfully but not sure which route to go and whats the difference.

Also Can you please let me know any mapping document which maps ODBC constructs between sybase and postgres.

Also list of ODBC constructs to be used with postgres.



If you are looking for a client to work with with your Postgres database,then you can use psql(for command line),or use PGAdmin (http://www.pgadmin.org/).

If you are looking to connect data from your Sybase database to a Postgres database,you can have a look at the various
Foreign data wrappers Postgres has.

If you wish to work in C,then,I would suggest libpq.I would wait for more replies on this,as I have little knowledge
about psqlODBC.

Regards,

Atri


Re: ODBC constructs

От
Dev Kumkar
Дата:
On Mon, May 20, 2013 at 9:12 PM, Atri Sharma <atri.jiit@gmail.com> wrote:

If you wish to work in C,then,I would suggest libpq.I would wait for more replies on this,as I have little knowledge
about psqlODBC.

Thanks for the comments. Yes objective is to work in C and found libpq useful but am not sure about psqlODBC.
It would be really great to get comments from community here regarding comparison between both of them and also performance perspective. Based on my reading so far libpq is good from performance perspective.

Regards...

Re: ODBC constructs

От
John R Pierce
Дата:
On 5/20/2013 10:11 PM, Dev Kumkar wrote:
On Mon, May 20, 2013 at 9:12 PM, Atri Sharma <atri.jiit@gmail.com> wrote:

If you wish to work in C,then,I would suggest libpq.I would wait for more replies on this,as I have little knowledge
about psqlODBC.

Thanks for the comments. Yes objective is to work in C and found libpq useful but am not sure about psqlODBC.
It would be really great to get comments from community here regarding comparison between both of them and also performance perspective. Based on my reading so far libpq is good from performance perspective.

libpq lets you talk directly to postgres in its native tongue.

ODBC implements a sort of abstraction.     IMHO, its like trying to type with mittens on.





-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

Re: ODBC constructs

От
Atri Sharma
Дата:

Sent from my iPad

On 21-May-2013, at 11:24, John R Pierce <pierce@hogranch.com> wrote:

> libpq lets you talk directly to postgres in its native tongue.
>
> ODBC implements a sort of abstraction.     IMHO, its like trying to type with mittens on.
>
Also,I see no point in working using ODBC with Postgres if you want to work in C,when libpq is
available.IMHO,it is like adding an extra layer without any purpose,or I may be wrong here.

Also,is it only me,or are we all a bit wary of ODBC? I think JDBC is becoming the standard now(of course,its Java,but
asI said, you should use libpq if you want to write native code for Postgres). 

Regards,

Atri

Re: ODBC constructs

От
John R Pierce
Дата:
On 5/20/2013 11:04 PM, Atri Sharma wrote:
> Also,is it only me,or are we all a bit wary of ODBC?

its clumsy.    getting software working well with it requires more
work.   its promise of portability only holds true if you restrict
yourself to SQL that works the same on different servers, and if you do
that, odds are you'll be optimal on none of them.



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: ODBC constructs

От
Guy Rouillier
Дата:
On 5/21/2013 1:11 AM, Dev Kumkar wrote:

> Thanks for the comments. Yes objective is to work in C and found libpq
> useful but am not sure about psqlODBC.
> It would be really great to get comments from community here regarding
> comparison between both of them and also performance perspective. Based
> on my reading so far libpq is good from performance perspective.

One advantage of an abstraction layer is that it allows you to switch
the underlying DBMS with few if any changes to your code.  ODBC is just
one of many available abstraction layers.  So, one thing to consider is
if your application is intended to be at all generic, or if it is
specifically targeted to PostgreSQL.  If the former, then you should
consider an abstraction layer; if not, then libpq is fine.

Another determinant for many people is what they already know.  If I'm
doing a quick, one-time app and I know ODBC but I don't know libpq, I
might choose to just stick with what I know and use ODBC.

So, really, the first decision you should make is how general you want
your app to be, and how long you expect to use it.  Other decisions flow
from there.

--
Guy Rouillier


Re: [ODBC] ODBC constructs

От
Heikki Linnakangas
Дата:
On 21.05.2013 08:11, Dev Kumkar wrote:
> On Mon, May 20, 2013 at 9:12 PM, Atri Sharma<atri.jiit@gmail.com>  wrote:
>
>>
>> If you wish to work in C,then,I would suggest libpq.I would wait for more
>> replies on this,as I have little knowledge
>> about psqlODBC.
>>
>
> Thanks for the comments. Yes objective is to work in C and found libpq
> useful but am not sure about psqlODBC.
> It would be really great to get comments from community here regarding
> comparison between both of them and also performance perspective. Based on
> my reading so far libpq is good from performance perspective.

libpq is generally-speaking better than psqlodbc. The advantage of ODBC
is that if you have a suitable driver, you can connect to other DBMS' as
well, while libpq will only work with PostgreSQL. Unless you need such
portability, go with libpq.

- Heikki


Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Mon, May 20, 2013 at 11:32 PM, Heikki Linnakangas <hlinnakangas@vmware.com> wrote:
libpq is generally-speaking better than psqlodbc. The advantage of ODBC is that if you have a suitable driver, you can connect to other DBMS' as well, while libpq will only work with PostgreSQL. Unless you need such portability, go with libpq.

Thanks everyone for sharing comments, really useful ones. Yes the requirement is not connecting to other DBMS but only Postgres and libpq is the correct way so far from comments here. Regarding libpq performance wanted to discuss about connection polling like pgpool but I think a separate post of performance will make sense.

So, coming back to the original question actually I am exploring on both fronts here - libpq and psqlODBC.
Just one thought here, there is an existing ODBC business logic code which is talking to sybase database and now same code need to be ported to talk to postgres, then in this case will the use of psqlODBC quick way? Otherwise porting of ODBC business logic to libpq constructs needs to be done.

Regards...

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/21/2013 11:58 AM, Dev Kumkar wrote:
Thanks everyone for sharing comments, really useful ones. Yes the requirement is not connecting to other DBMS but only Postgres and libpq is the correct way so far from comments here. Regarding libpq performance wanted to discuss about connection polling like pgpool but I think a separate post of performance will make sense.


for pooling, check out pgbouncer.   IMHO its a better basic pooler than pg_pool. 

So, coming back to the original question actually I am exploring on both fronts here - libpq and psqlODBC.
Just one thought here, there is an existing ODBC business logic code which is talking to sybase database and now same code need to be ported to talk to postgres, then in this case will the use of psqlODBC quick way? Otherwise porting of ODBC business logic to libpq constructs needs to be done.


thats the perfect use case for ODBC.    you'll probably still need to rework some of your SQL if you did stuff thats Sybase specific, but thats a lot less hassle than rewriting all the API calls.


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 12:16 PM, John R Pierce <pierce@hogranch.com> wrote:

for pooling, check out pgbouncer.   IMHO its a better basic pooler than pg_pool. 

Sure, looks like its more light weight. And I hope, its not related to the decision between libpq and psqlODBC. And will work with both?

thats the perfect use case for ODBC.    you'll probably still need to rework some of your SQL if you did stuff thats Sybase specific, but thats a lot less hassle than rewriting all the API calls.

Yeah, hope you got my confusion and inclination now.
Well to work with psqlODBC, will I need to recompile the psqlODBC binary and any additional stuff to get ODBC working?
http://www.postgresql.org/ftp/odbc/versions/src/ has sources for windows or am I missing something here?

Regards...

Re: [ODBC] ODBC constructs

От
Guy Rouillier
Дата:
On 5/21/2013 3:32 PM, Dev Kumkar wrote:
> Well to work with psqlODBC, will I need to recompile the psqlODBC binary
> and any additional stuff to get ODBC working?

No, you don't need to recompile any libraries.  You just use them.

--
Guy Rouillier


Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:

On Tue, May 21, 2013 at 12:32 PM, Dev Kumkar <devdas.kumkar@gmail.com> wrote:
On Tue, May 21, 2013 at 12:16 PM, John R Pierce <pierce@hogranch.com> wrote:

for pooling, check out pgbouncer.   IMHO its a better basic pooler than pg_pool. 

Sure, looks like its more light weight. And I hope, its not related to the decision between libpq and psqlODBC. And will work with both?

thats the perfect use case for ODBC.    you'll probably still need to rework some of your SQL if you did stuff thats Sybase specific, but thats a lot less hassle than rewriting all the API calls.

Yeah, hope you got my confusion and inclination now.
Well to work with psqlODBC, will I need to recompile the psqlODBC binary and any additional stuff to get ODBC working?
http://www.postgresql.org/ftp/odbc/versions/src/ has sources for windows or am I missing something here for linux? If Windows, then I think its just download and run the distribution. And for linux are those the same archives listed in link?

Regards...

Edited: Added some more text related to installing psqlODBC driver.

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 12:35 PM, Guy Rouillier <guy.rouillier@gmail.com> wrote:
On 5/21/2013 3:32 PM, Dev Kumkar wrote:
Well to work with psqlODBC, will I need to recompile the psqlODBC binary
and any additional stuff to get ODBC working?

No, you don't need to recompile any libraries.  You just use them.

Ah I think our emails crossed.

http://www.postgresql.org/ftp/odbc/versions/src/ has sources for windows or am I missing something here for linux? If Windows, then I think its just download and run the distribution.
But for linux are those the same archives listed in link and then recompile is the only option?

Regards...

Re: [ODBC] ODBC constructs

От
Dann Corbit
Дата:

[snip]


Yeah, hope you got my confusion and inclination now.

Well to work with psqlODBC, will I need to recompile the psqlODBC binary and any additional stuff to get ODBC working?
http://www.postgresql.org/ftp/odbc/versions/src/ has sources for windows or am I missing something here?

Regards...

>> 

Just install the driver and use it.  You don’t have to build the driver.  It is already built for you.  Look here if you need Solaris or BSD:

http://www.postgresql.org/download/

Or  go directly here for Mac, Windows or Linux:

http://www.enterprisedb.com/products-services-training/pgdownload#windows

and click on the link that is right for your operating system.

<< 

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 12:45 PM, Dann Corbit <DCorbit@connx.com> wrote:
>> 

Just install the driver and use it.  You don’t have to build the driver.  It is already built for you.  Look here if you need Solaris or BSD:

http://www.postgresql.org/download/

Or  go directly here for Mac, Windows or Linux:

http://www.enterprisedb.com/products-services-training/pgdownload#windows

and click on the link that is right for your operating system.

<< 


I already have installed this on Linux from above link some days back but not able to find library. Can you point me to the same?
Also this link says to compile if its non-windows - http://psqlodbc.projects.pgfoundry.org/faq.html#1.2 Check 1.3

Can you point me to samples out there?

Regards...

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/21/2013 1:59 PM, Dev Kumkar wrote:
>
> I already have installed this on Linux from above link some days back
> but not able to find library. Can you point me to the same?
> Also this link says to compile if its non-windows -
> http://psqlodbc.projects.pgfoundry.org/faq.html#1.2 Check 1.3
>
> Can you point me to samples out there?

what specific non-Windows operating system distribution are you using?
ODBC stuff is packaged for most of them.  for instance, the
yum.postgresql.org repository has it packaged as postgresql92-odbc,
available for a variety of redhat/fedora/centos style systems, I'm sure
the debian/ubuntu apt repositories have similar.


--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 3:17 PM, John R Pierce <pierce@hogranch.com> wrote:
what specific non-Windows operating system distribution are you using?  ODBC stuff is packaged for most of them.  for instance, the yum.postgresql.org repository has it packaged as postgresql92-odbc, available for a variety of redhat/fedora/centos style systems, I'm sure the debian/ubuntu apt repositories have similar.

Currently looking for RHEL 5. Thanks! yes looked into my machine and "yum list postgres*" listed "postgresql91-odbc.x86_64"
But when trying to install, then found the base ODBC library itself are missing and those needs to be configured first on test machine.

Error: Missing Dependency: libodbc.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)
Error: Missing Dependency: libodbcinst.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)

Regards...

Re: [ODBC] ODBC constructs

От
Dann Corbit
Дата:

From: Dev Kumkar [mailto:devdas.kumkar@gmail.com]
Sent: Tuesday, May 21, 2013 1:59 PM
To: Dann Corbit
Cc: John R Pierce; pgsql-general@postgresql.org; pgsql-odbc@postgresql.org
Subject: Re: [ODBC] [GENERAL] ODBC constructs

 

[snip]

I already have installed this on Linux from above link some days back but not able to find library. Can you point me to the same?
Also this link says to compile if its non-windows - http://psqlodbc.projects.pgfoundry.org/faq.html#1.2 Check 1.3

Can you point me to samples out there?

Regards...

>> 

When you install an ODBC driver, it does not install a library.  It installs a DLL or shared object.

If you have already installed the driver, then set up your data source with a data source manager.

 

IODBC is a popular driver manager:

http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/

 

and UNIXODBC is another popular choice for an ODBC driver manager:

http://www.unixodbc.org/

 

You link your application against the ODBC library for your platform.  Then it works with any data source you have configured using your driver manager.

 

Here is a little blurb about driver managers:

http://dev.mysql.com/doc/connector-odbc/en/connector-odbc-driver-manager.html

 

Here is an outline of using ODBC with IODBC:

http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/ODBCOnUnix

 

Here are the UNIXODBC manuals:

http://www.unixodbc.org/doc/

 

<< 

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/21/2013 3:49 PM, Dev Kumkar wrote:
On Tue, May 21, 2013 at 3:17 PM, John R Pierce <pierce@hogranch.com> wrote:
what specific non-Windows operating system distribution are you using?  ODBC stuff is packaged for most of them.  for instance, the yum.postgresql.org repository has it packaged as postgresql92-odbc, available for a variety of redhat/fedora/centos style systems, I'm sure the debian/ubuntu apt repositories have similar.

Currently looking for RHEL 5. Thanks! yes looked into my machine and "yum list postgres*" listed "postgresql91-odbc.x86_64"
But when trying to install, then found the base ODBC library itself are missing and those needs to be configured first on test machine.

Error: Missing Dependency: libodbc.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)
Error: Missing Dependency: libodbcinst.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)

that should have come from the base repository...

# yum provides libodbc.so.1
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.hoobly.com
 * extras: centos.mirror.freedomvoice.com
 * updates: centos-distro.cavecreek.net
unixODBC-libs-2.2.11-10.el5.i386 : The shared libraries required by programs that use unixODBC
Repo        : base
Matched from:
Other       : libodbc.so.1



unixODBC-libs-2.2.11-10.el5.i386 : The shared libraries required by programs that use unixODBC
Repo        : installed
Matched from:
Other       : Provides-match: libodbc.so.1

(on a 32bit EL5 system)


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 5:21 PM, Dann Corbit <DCorbit@connx.com> wrote:
When you install an ODBC driver, it does not install a library.  It installs a DLL or shared object.

If you have already installed the driver, then set up your data source with a data source manager.

 

IODBC is a popular driver manager:

http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/

 

and UNIXODBC is another popular choice for an ODBC driver manager:

http://www.unixodbc.org/

 

You link your application against the ODBC library for your platform.  Then it works with any data source you have configured using your driver manager.

 

Here is a little blurb about driver managers:

http://dev.mysql.com/doc/connector-odbc/en/connector-odbc-driver-manager.html

 

Here is an outline of using ODBC with IODBC:

http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/ODBCOnUnix

 

Here are the UNIXODBC manuals:

http://www.unixodbc.org/doc/


The link http://www.enterprisedb.com/products-services-training/pgdownload#windows which you had earlier provided was postgres installation. It installed libpq but odbc library was not installed.  I hope am looking at correct things.

Re: [ODBC] ODBC constructs

От
Dann Corbit
Дата:

From: Dev Kumkar [mailto:devdas.kumkar@gmail.com]
Sent: Tuesday, May 21, 2013 7:03 PM
To: Dann Corbit
Cc: John R Pierce; pgsql-general@postgresql.org; pgsql-odbc@postgresql.org
Subject: Re: [ODBC] [GENERAL] ODBC constructs

[snip]

The link http://www.enterprisedb.com/products-services-training/pgdownload#windows which you had earlier provided was postgres installation. It installed libpq but odbc library was not installed.  I hope am looking at correct things.

>> 

The ODBC library is contained in either the iodbc or unixodbc RPMs.

The correct RPM to use will depend on your operating system.

<< 

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 7:09 PM, Dann Corbit <DCorbit@connx.com> wrote:
The ODBC library is contained in either the iodbc or unixodbc RPMs.

The correct RPM to use will depend on your operating system.


Where are these located?

Re: [ODBC] ODBC constructs

От
Dann Corbit
Дата:

From: Dev Kumkar [mailto:devdas.kumkar@gmail.com]
Sent: Tuesday, May 21, 2013 7:13 PM
To: Dann Corbit
Cc: John R Pierce; pgsql-general@postgresql.org; pgsql-odbc@postgresql.org
Subject: Re: [ODBC] [GENERAL] ODBC constructs

 

On Tue, May 21, 2013 at 7:09 PM, Dann Corbit <DCorbit@connx.com> wrote:

The ODBC library is contained in either the iodbc or unixodbc RPMs.

The correct RPM to use will depend on your operating system.

 

Where are these located?

>> 

I do not know if you have 64 bit or 32 bit Linux and if it is Redhat or Mandrake or whatever.

To be clear:

The PostgreSQL distribution allows you to download the PostgreSQL ODBC driver.  The PostgreSQL ODBC driver is not a library.  It is a shared object that uses a standardized API to communicate with the PostgreSQL database.  This allows standards based tools to access the data by linking to a single library (the ODBC library) and then connecting to as many different database systems as you like that have well written ODBC drivers.

In order to use an ODBC driver, you do need an ODBC library.  Microsoft has one that comes installed.  For Posix systems, you can choose between IODBC and UNIXODBC implementations.   I would probably try them both if I were you and choose the one that I like best. 

Maybe this google query can help you:

https://www.google.com/search?q=%28iodbc+OR+unixodbc%29+postgresql+tutorial&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:unofficial&client=firefox-nightly#client=firefox-nightly&hs=6pK&rls=org.mozilla:en-US%3Aunofficial&sclient=psy-ab&q=%28iodbc+OR+unixodbc%29+postgresql+tutorial&oq=%28iodbc+OR+unixodbc%29+postgresql+tutorial&gs_l=serp.12...0.0.0.39894.0.0.0.0.0.0.0.0..0.0...0.0...1c..14.psy-ab.E8PvcYa5HCc&pbx=1&bav=on.2,or.r_qf.&bvm=bv.46751780,d.cGE&fp=9deb35a4864e0689&biw=1920&bih=1027

<< 

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
Currently looking for RHEL 5. Thanks! yes looked into my machine and "yum list postgres*" listed "postgresql91-odbc.x86_64"
But when trying to install, then found the base ODBC library itself are missing and those needs to be configured first on test machine.

Error: Missing Dependency: libodbc.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)
Error: Missing Dependency: libodbcinst.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)

that should have come from the base repository...

# yum provides libodbc.so.1
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.hoobly.com
 * extras: centos.mirror.freedomvoice.com
 * updates: centos-distro.cavecreek.net
unixODBC-libs-2.2.11-10.el5.i386 : The shared libraries required by programs that use unixODBC
Repo        : base
Matched from:
Other       : libodbc.so.1

unixODBC-libs-2.2.11-10.el5.i386 : The shared libraries required by programs that use unixODBC
Repo        : installed
Matched from:
Other       : Provides-match: libodbc.so.1

(on a 32bit EL5 system)

 Ya it should have been with base registry. Where to get unixODBC-libs-2.2.11-10.el5.i386?

Since ODBC driver was missing, downloaded unixODBC-2.3.0.tar.gz and configured/make this. Now "which odbc_config" works
       # which odbc_config
       /usr/local/bin/odbc_config
       # odbc_config --libs
       -L/usr/local/lib -lodbc

But still 'yum install postgresql91-odbc' is giving errors.
Error: Missing Dependency: libodbc.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)
Error: Missing Dependency: libodbcinst.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)

I tried the other way then, building psqlodbc itself:
Downloaded psqlodbc driver from http://psqlodbc.projects.postgresql.org/ and tried configuring it. It also gave error saying 'libpq' not found. Then ran "yum -y install postgresql91-devel" and then configured with "$ ./configure --with-libpq=/usr/pgsql-9.1/bin/pg_config" this worked without 'libpq error'. But still no real success as there were many errors thrown for 'SQLExtendedFetch' and 'SQLROWSETSIZE'.

Suggestions?

Regards...

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/21/2013 7:02 PM, Dev Kumkar wrote:
The link http://www.enterprisedb.com/products-services-training/pgdownload#windows which you had earlier provided was postgres installation. It installed libpq but odbc library was not installed.  I hope am looking at correct things.

after installing postgres for windows with that installer, run the Stack Builder tool, it will install additional postgres related packages, one of which is pgsqlODBC



-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/21/2013 7:27 PM, Dev Kumkar wrote:
>  Ya it should have been with base registry. Where to get
> unixODBC-libs-2.2.11-10.el5.i386?
>

# yum install unixODBC-libs

should install the latest version from the distribution base repositories.




> Since ODBC driver was missing, downloaded unixODBC-2.3.0.tar.gz and
> configured/make this. Now "which odbc_config" works
>        # which odbc_config
>        /usr/local/bin/odbc_config
>        # odbc_config --libs
>        -L/usr/local/lib -lodbc

arrgh, now you're making a mess.

standard 2 part warranty applies here, you get to keep both pieces if
you're mixing packaged software with custom built.





--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: [ODBC] ODBC constructs

От
Dann Corbit
Дата:

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Dev Kumkar
Sent: Tuesday, May 21, 2013 7:27 PM
To: John R Pierce
Cc: pgsql-general@postgresql.org; pgsql-odbc@postgresql.org
Subject: Re: [ODBC] [GENERAL] ODBC constructs

 

[snip]

 

Suggestions?

>> 

https://rhn.redhat.com/errata/RHEA-2012-0222.html

<< 

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 7:35 PM, John R Pierce <pierce@hogranch.com> wrote:
On 5/21/2013 7:02 PM, Dev Kumkar wrote:
The link http://www.enterprisedb.com/products-services-training/pgdownload#windows which you had earlier provided was postgres installation. It installed libpq but odbc library was not installed.  I hope am looking at correct things.

after installing postgres for windows with that installer, run the Stack Builder tool, it will install additional postgres related packages, one of which is pgsqlODBC

Hey am on RHEL 5. The above you state is for Windows.

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/21/2013 7:33 PM, Dev Kumkar wrote:
> Red Hat Enterprise Linux Server release 5.5.

5.5 is a fairly old release of Red Hat Enteprise Linux Server release 5,
they are up to 5.9 now.   simply running `yum update` should get you the
latest incremental files


now, if you're running RHEL without a subscription, you're stuck here,
as you can't use yum to install anything from the Red Hat repositories,
they are for subscribers only.   If you want to run a free version with
open repositories, you should consider running CentOS


--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 7:40 PM, John R Pierce <pierce@hogranch.com> wrote:
# yum install unixODBC-libs

should install the latest version from the distribution base repositories.
 
Its not finding it. May be I need to get on another box then, not sure.

Since ODBC driver was missing, downloaded unixODBC-2.3.0.tar.gz and configured/make this. Now "which odbc_config" works
       # which odbc_config
       /usr/local/bin/odbc_config
       # odbc_config --libs
       -L/usr/local/lib -lodbc

arrgh, now you're making a mess.

standard 2 part warranty applies here, you get to keep both pieces if you're mixing packaged software with custom built.

You want me clean some stuff. Because I installed 'unixODBC-2.3.0'?

On Tue, May 21, 2013 at 7:47 PM, John R Pierce <pierce@hogranch.com> wrote:
5.5 is a fairly old release of Red Hat Enteprise Linux Server release 5, they are up to 5.9 now.   simply running `yum update` should get you the latest incremental files

now, if you're running RHEL without a subscription, you're stuck here, as you can't use yum to install anything from the Red Hat repositories, they are for subscribers only.   If you want to run a free version with open repositories, you should consider running CentOS

I can do 'yum update' and its started to update 1st package. Although I exit, just want to confirm there is no unixODBC-libs package so it will not update it. Is that correct?

Regards...

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/21/2013 8:33 PM, Dev Kumkar wrote:
>
> I can do 'yum update' and its started to update 1st package. Although
> I exit, just want to confirm there is no unixODBC-libs package so it
> will not update it. Is that correct?

I have no idea what you're saying here.   what 1st package?  you should
apply all pending updates to your operating system as a matter of good
practice.    if this is a production system, you should of course, test
the updates on a staging server before updating production.

again,  simply...

     yum install unixODBC-libs

that should install the ODBC runtime libraries that the postgres driver
requires.  if it doesn't then you don't have access to the RHEL
repositories, which suggests you're either not a subscriber, or you
haven't properly registered this system via your Red Hat Network
account.   If this system doesn't have a paid Red Hat Enterprise Linux
support contract, then you really shouldn't BE running Red Hat
Enterprise Linux as you can't install anything, can't get security
updates, or anything.  CentOS 5 or 6 are compatible rebuilds with free
public repositories.







--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 8:40 PM, Dann Corbit <DCorbit@connx.com> wrote:
>>

I guess that if you did a successful make install of unixODBC-2.3.0 it will work as your ODBC driver manager.

On the other hand, it is easier and more trouble free to use the standardized package installer for your distribution.

<< 

Yes unixODBC-2.3.0 successfully installed.

On Tue, May 21, 2013 at 9:02 PM, John R Pierce <pierce@hogranch.com> wrote:
I have no idea what you're saying here.   what 1st package?  you should apply all pending updates to your operating system as a matter of good practice.    if this is a production system, you should of course, test the updates on a staging server before updating production.

Yes, actually package update started but need to get this done on stage server first for existing packages. I meant if unixODBC-libs is not present on this system then update for it will not be patched.
 
again,  simply...

    yum install unixODBC-libs

that should install the ODBC runtime libraries that the postgres driver requires.  if it doesn't then you don't have access to the RHEL repositories, which suggests you're either not a subscriber, or you haven't properly registered this system via your Red Hat Network account.   If this system doesn't have a paid Red Hat Enterprise Linux support contract, then you really shouldn't BE running Red Hat Enterprise Linux as you can't install anything, can't get security updates, or anything.  CentOS 5 or 6 are compatible rebuilds with free public repositories.

Need to check this tomorrow regarding registration.

BTW where does the 'postgresql91-odbc.x86_64' looking for libodbc.so.1 and libodbcinst.so.1 files.
unixODBC-2.3.0 was successfully installed and both these libraries are under /usr/local/lib/.
# ldd libodbc.so.1
        libdl.so.2 => /lib64/libdl.so.2 (0x00002b3fb5661000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b3fb5865000)
        libc.so.6 => /lib64/libc.so.6 (0x00002b3fb5a80000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003164800000)

Also tried to export PATH and LD_LIBRARY_PATH and then ran 'yum install postgresql91-odbc' but still facing same errors:
     Error: Missing Dependency: libodbc.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64 (pgdg91)
     Error: Missing Dependency: libodbcinst.so.1()(64bit) is needed by package postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64    
     (pgdg91)

Any particular location or is it like unixODBC-2.3.0 installation is not enough to bless 'postgresql91-odbc.x86_64' package installation.

Regards...

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/21/2013 10:37 PM, Dev Kumkar wrote:
> BTW where does the 'postgresql91-odbc.x86_64' looking for libodbc.so.1
> and libodbcinst.so.1 files.

its looking for the RPM installed packages it was linked against. its
not looking to see if any same named files just happen to be on your system.



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 10:49 PM, John R Pierce <pierce@hogranch.com> wrote:
its looking for the RPM installed packages it was linked against. its not looking to see if any same named files just happen to be on your system.

Oh, got it. So the only way is to do bless it thru 'yum install unixODBC-libs' only. Hmm need this going tomorrow. Thanks so far!

The other method which I was trying to manually install psqlODBC library is also stuck because of incomplete configuration.

Regards...

Re: [ODBC] ODBC constructs

От
John R Pierce
Дата:
On 5/22/2013 11:24 AM, Dev Kumkar wrote:
Started first with looking more into building psqlODBC today


why the heck are you not installing unixODBC-libs from RPMs ?!?

    yum install unixODBC64 unixODBC64-libs unixODBC64-devel

should do it, unless you're on Red Hat Enterprise without a subscription, then you can do it the hard way... 
mkdir unixODBCdownloads && cd unixODBCdownloads
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/unixODBC64-2.2.14-3.el5.x86_64.rpm
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/unixODBC64-libs-2.2.14-3.el5.x86_64.rpm
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/unixODBC64-devel-2.2.14-3.el5.x86_64.rpm
rpm -Uvh *.rpm
if you get any dependency errors, fetch the required RPMs from http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/ and install manually with the rpm command.   don't be surprised if the dependencies have dependencies, normally yum would sort that out automatically.

if your application is 32bit, then you'll need to install 32bit ODBC instead of the 64bit stuff above.

if you ARE on Red Hat Enterprise Linux without a RHN subscription, you really really should be on CentOS instead, its a 100% compatible distribution rebuilt from Red Hat sources with the branding and redhat network subscription stuff removed and replaced with open yum repositories.

btw, i'm offline til next week.  have fun with that.


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Wed, May 22, 2013 at 11:44 AM, John R Pierce <pierce@hogranch.com> wrote:
why the heck are you not installing unixODBC-libs from RPMs ?!?

    yum install unixODBC64 unixODBC64-libs unixODBC64-devel

should do it, unless you're on Red Hat Enterprise without a subscription, then you can do it the hard way... 
mkdir unixODBCdownloads && cd unixODBCdownloads
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/unixODBC64-2.2.14-3.el5.x86_64.rpm
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/unixODBC64-libs-2.2.14-3.el5.x86_64.rpm
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/unixODBC64-devel-2.2.14-3.el5.x86_64.rpm
rpm -Uvh *.rpm
if you get any dependency errors, fetch the required RPMs from http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/ and install manually with the rpm command.   don't be surprised if the dependencies have dependencies, normally yum would sort that out automatically.

if your application is 32bit, then you'll need to install 32bit ODBC instead of the 64bit stuff above.

if you ARE on Red Hat Enterprise Linux without a RHN subscription, you really really should be on CentOS instead, its a 100% compatible distribution rebuilt from Red Hat sources with the branding and redhat network subscription stuff removed and replaced with open yum repositories.

btw, i'm offline til next week.  have fun with that.

Yes, its RHE without subscription. Hard time!
On a different box, I did the other way and installed unixODBC64 using the above links. There were some libtdl* dependencies and installed package libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm for that.
unixODBC is done with the above method.

Can you list steps for psqlODBC?

Should i get packages in this way http://wiki.postgresql.org/wiki/YUM_Installation?

Regards...

Re: [ODBC] ODBC constructs

От
Dann Corbit
Дата:

From: Dev Kumkar [mailto:devdas.kumkar@gmail.com]
Sent: Tuesday, May 21, 2013 7:33 PM
To: Dann Corbit
Cc: John R Pierce; pgsql-general@postgresql.org; pgsql-odbc@postgresql.org
Subject: Re: [ODBC] [GENERAL] ODBC constructs

[snip]

Thanks for the info. Its Red Hat Enterprise Linux Server release 5.5.

Re: [ODBC] ODBC constructs

От
Dann Corbit
Дата:

[snip]

 

You want me clean some stuff. Because I installed 'unixODBC-2.3.0'?

>> 

I guess that if you did a successful make install of unixODBC-2.3.0 it will work as your ODBC driver manager.

On the other hand, it is easier and more trouble free to use the standardized package installer for your distribution.

<< 

[snip]

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Wed, May 22, 2013 at 4:10 PM, Devrim GÜNDÜZ <devrim@gunduz.org> wrote:

Yes, or, as mentioned before, you can simply download the RPM directly
from the repo.
Thanks Devrim!

Installed postgres-92 server from postgresql92-server-9.2.4-1PGDG.rhel5.x86_64.rpm, actually links which John (Thanks!) mentioned were for CentOS, actually installed unixODBC with them only but then for postgres DB used the one for RHEL http://yum.postgresql.org/9.2/redhat/rhel-5.0-x86_64/
Had to reload unixODBC-libs-2.2.11-10.el5.x86_64.rpm again and then also got postgresql92-odbc rpm from RHEL link.
Things are now installed.

So I have one box with compiled unixodbc and psqlodbc from sources.
And other box where unixodbc and psqlodbc are installed via rpm way.

Can someone provide a quick C odbc code snippet?

Regards...


Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 11:28 PM, Dev Kumkar <devdas.kumkar@gmail.com> wrote:
On Tue, May 21, 2013 at 10:49 PM, John R Pierce <pierce@hogranch.com> wrote:
its looking for the RPM installed packages it was linked against. its not looking to see if any same named files just happen to be on your system.

Oh, got it. So the only way is to do bless it thru 'yum install unixODBC-libs' only. Hmm need this going tomorrow. Thanks so far!

The other method which I was trying to manually install psqlODBC library is also stuck because of incomplete configuration.

Started first with looking more into building psqlODBC today and things looks good. Need to write a test program though.

# cd psqlodbc-09.01.0200

-- The configuration failed with following error (same as yesterday)
# ./configure
configure: error: libpq library not found

-- ran with --with-libpq and it could find libpq this time
# ./configure --with-libpq=/usr/pgsql-9.1

-- next make failed with following error
# make
odbcapi.c:1125: error: expected declaration specifiers or '...' before 'SQLROWSE
odbcapi.c:1130: error: conflicting types for 'SQLExtendedFetch'
/usr/local/include/sqlext.h:1927: error: previous declaration of 'SQLExtendedFet
odbcapi.c: In function 'SQLExtendedFetch':
odbcapi.c:1143: error: 'pcrow' undeclared (first use in this function)
odbcapi.c:1143: error: (Each undeclared identifier is reported only once
odbcapi.c:1143: error: for each function it appears in.)
make[1]: *** [odbcapi.lo] Error 1
make[1]: Leaving directory `/installers/psqlodbc-09.01.0200'
make: *** [all] Error 2

-- Went ahead and edited odbcapi.c and changed definition of SQLExtendedFetch
-- to match with the types defined in /usr/local/include/sqlext/sqlext.h
-- Works this time
# make

# make install
make[1]: Entering directory `/installers/psqlodbc-09.01.0200'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
 /bin/sh ./libtool   --mode=install /usr/bin/install -c  'psqlodbcw.la' '/usr/local/lib/psqlodbcw.la'
libtool: install: /usr/bin/install -c .libs/psqlodbcw.so /usr/local/lib/psqlodbcw.so
libtool: install: /usr/bin/install -c .libs/psqlodbcw.lai /usr/local/lib/psqlodbcw.la
libtool: finish: PATH="......." ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/installers/psqlodbc-09.01.0200'
#

Well need to write a test program though whether its really working.

Regards...

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Tue, May 21, 2013 at 7:25 PM, Dann Corbit <DCorbit@connx.com> wrote:
>> 

I do not know if you have 64 bit or 32 bit Linux and if it is Redhat or Mandrake or whatever.

To be clear:

The PostgreSQL distribution allows you to download the PostgreSQL ODBC driver.  The PostgreSQL ODBC driver is not a library.  It is a shared object that uses a standardized API to communicate with the PostgreSQL database.  This allows standards based tools to access the data by linking to a single library (the ODBC library) and then connecting to as many different database systems as you like that have well written ODBC drivers.

In order to use an ODBC driver, you do need an ODBC library.  Microsoft has one that comes installed.  For Posix systems, you can choose between IODBC and UNIXODBC implementations.   I would probably try them both if I were you and choose the one that I like best. 

Maybe this google query can help you:

https://www.google.com/search?q=%28iodbc+OR+unixodbc%29+postgresql+tutorial&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:unofficial&client=firefox-nightly#client=firefox-nightly&hs=6pK&rls=org.mozilla:en-US%3Aunofficial&sclient=psy-ab&q=%28iodbc+OR+unixodbc%29+postgresql+tutorial&oq=%28iodbc+OR+unixodbc%29+postgresql+tutorial&gs_l=serp.12...0.0.0.39894.0.0.0.0.0.0.0.0..0.0...0.0...1c..14.psy-ab.E8PvcYa5HCc&pbx=1&bav=on.2,or.r_qf.&bvm=bv.46751780,d.cGE&fp=9deb35a4864e0689&biw=1920&bih=1027

<< 

Thanks for the info. Its Red Hat Enterprise Linux Server release 5.5.
Please also take a look at my previous reply too.

Re: [ODBC] ODBC constructs

От
Dev Kumkar
Дата:
On Wed, May 22, 2013 at 6:06 PM, Dev Kumkar <devdas.kumkar@gmail.com> wrote:
On Wed, May 22, 2013 at 4:10 PM, Devrim GÜNDÜZ <devrim@gunduz.org> wrote:

Yes, or, as mentioned before, you can simply download the RPM directly
from the repo.
Thanks Devrim!

Installed postgres-92 server from postgresql92-server-9.2.4-1PGDG.rhel5.x86_64.rpm, actually links which John (Thanks!) mentioned were for CentOS, actually installed unixODBC with them only but then for postgres DB used the one for RHEL http://yum.postgresql.org/9.2/redhat/rhel-5.0-x86_64/
Had to reload unixODBC-libs-2.2.11-10.el5.x86_64.rpm again and then also got postgresql92-odbc rpm from RHEL link.
Things are now installed.

So I have one box with compiled unixodbc and psqlodbc from sources.
And other box where unixodbc and psqlodbc are installed via rpm way.

Can someone provide a quick C odbc code snippet?

Regards...

Nevermind, I could write some C odbc programs for verification of compiled sources and working with postgres db.
Also program compilation and execution is working on both the machines one with compiled sources of unixODBC and psqlODBC and the other with rpm repository installed ones.

Pretty long thread. Thanks everyone for their excellent support here!

Regards...