[RESOLVED] ODBC problem with Postgre in Asterisk 1.2


I try configure Realtime in Asterisk 1.2RC2 on my SUSE Linux box following the asteriskguru tutorial (www.asteriskguru.com/tutorials/realtime_pgsql.html).

I can connect locally to the Postgre Database. But when starting Asterisk it just freezes at the point where it trys to connect to the database. This is what the log says:

NOTICE[3313]: res_odbc.c:294 load_odbc_config: registered database handle ‘ast_cnf’ dsn->[asterisk]
NOTICE[3313]: res_odbc.c:552 odbc_obj_connect: Connecting ast_cnf

There are no error messages.

I tried some things and noticed that it behaves exactly the same way when the Postgre server is NOT running. It also does NOT make any difference when I comment out all entries in “pg_hba.conf” which are as follows:

local all all trust
host all all trust

I know these are very insecure settings (it’s only for debugging…).

I checked whether PGSQL is listening on port 5432…
netstat -na | grep 5432
unix 2 [ACC] STREAM LISTENING 8500 /tmp/.s.PGSQL.5432

And at this point I don’t know what to check furthermore :frowning:

When I change in res_odbc.conf the parameter “pre-connect” to “no” Asterisk starts properly.

I hope someone can help me.
Thanks a lot in advance!!!


[quote=“waldiman”]Thanks for your reply.

I actually did this (it was my post yesterday :wink: ).

What I wrote above, is the problem AFTER recompiling Asterisk with all needed libraries…

I will compile the full release now and come back again.[/quote]

Yes, I realized that as I was looking through and posting. I would recommend upgrading to the latest release of Asterisk v1.2 just released today:


Also, have you tried connecting with the unixODBC utility isql to make sure that your unixODBC -> Postgres are configured and connecting properly?

Thanks for the advice. It led me to the solution.

I tried isql in verbose mode and it did not work. It also did not show ANY errors…it just freezed as asterisk did. So I guessed it was an ODBC problem. Here I read up an ODBC: http://www.easysoft.com/developer/interfaces/odbc/linux.html (BTW a very good source for ODBC)

To keep it short…the problem was the USER DATA SOURCES file. I edited the general SYSTEM DATA SOURCES File at /etc/unixODBC/odbc.ini (SUSE default) and did not know that there is a user specific one in users home which is .odbc.ini (beware of the leading dot). I just copied the SYSTEM odbc.ini to the USER .odbc.ini and now a connection is established succesfully.

@MuppetMaster: Sorry for messing up the chronology of this thread… we were actually editing our posts at the same time…