Thread: How to configure iodbc access to local postgres db?

How to configure iodbc access to local postgres db?

From
Rob Yampolsky
Date:
I'm trying to get the iodbc driver manager to access postgres on the
local machine with the odbctest tool that comes with the iodbc stuff.
Having no luck.  Fails on the connect attempt, and I know I'm doing
something stupid, but don't know where to look.

Help (or a good .odbc.ini) would be appreciated.
Rob
ryampols@cjds.com

System is Mandrake 7.2 - postgres installed from RPM's on the MDK CD
(libraries in /usr/lib, postgres home is /var/lib/pgsql).

Logs this error in odbc.trace:
SQLDriverConnect ( ... )
SQL_NO_DATA_FOUND

My .odbc.ini file (accessed via ODBCINI env variable) looks like:

[ODBC Data Sources]
testdb          = PostgreSQL test database

[testdb]
Driver          = /usr/lib/libpsqlodbc.so.0
Description     = PostgreSQL test database
Host            = localhost
ServerType      = postgres
Port            = 5432
FetchBufferSize = 99
UserName        =
Password        =
Database        = testdb
ServerOptions   =
ConnectOptions  =
Options         =
ReadOnly        = no
Trace           = 1
TraceFile       = /tmp/odbc.trace
Debug           = 1
DebugFile       = /tmp/odbc.debug
CommLog         = 1



Re: How to configure iodbc access to local postgres db?

From
Rob Yampolsky
Date:
Told you it was something stupid.  Turns out I was using the wrong
Postgres ODBC driver.  My MDK 7.2 installation had 2 things that looked
like the driver.

/usr/lib/libpsqlodbc.so
and
/usr/lib/libodbcpsql.so

The correct one seems to be libodbcpsql

I had tried both, and originally using libodbcpsql caused a segmentation
violation, so I had been concentrating my efforts on the other one.

Well, I ended up following the setup instructions in the unixODBC package
documentation to get it working under that package.  Once it worked
there, I was able to get it working with libiodbc (which my application
was using).

Hint- it wants you to specify a UserName in .odbc.ini (you'd think it
would default to the 'current user').

Thanks for listening,
Rob