Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client

From: "Stefan Viljoen" <viljoens(at)verishare(dot)co(dot)za>
To: <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client
Date: 2015-07-20 06:30:27
Message-ID: 000c01d0c2b5$91b064f0$b5112ed0$@verishare.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi Nick

>Its getting past the driver manager to the driver in all cases, those
errors are from postgres driver or server.

Ok

>So when you do

psql -U asteriskcdruser -d asteriskcdrdb

>That does connect you are connecting to a different database, dont you need
to change the odbc.ini to have

> Database=asteriskcdrdb

>instead of the

> Database=dbname

>That you have shown to be in the ini file.

> [pgdb-cdr]
> ;Driver = /usr/pgsql-9.4/lib/psqlodbc.so
> Driver=PostgreSQL
> ServerName=localhost
> Port=5432
> UserName=dbuser
> Password=dbpassword
> Database=dbname
> ReadOnly=No
> Protocol=9.4
> Trace=Yes
> TraceFile=/tmp/sql.log
> ConnSettings=
> DSN=pgdb
> ServerType=Postgres
> Debug=1
> DebugFile=/var/log/postgresql_debug.log

Ok I changed by odbc.ini to read

---
[pgdb-cdr]
;Driver = /usr/pgsql-9.4/lib/psqlodbc.so
Driver=PostgreSQL
ServerName=localhost
Port=5432
UserName=username
Password=pword
Database=asteriskcdrdb
ReadOnly=No
Protocol=9.4
Trace=Yes
TraceFile=/tmp/sql.log
ConnSettings=
DSN=pgdb
ServerType=Postgres
Debug=1
DebugFile=/var/log/postgresql_debug.log
---

PostgreSQL is defined in my odbcinst.conf

The response still remains

---
[root(at)jhbasterisk pg_log]# isql -v pgdb-cdr username pword
[S1000][unixODBC]The database does not exist on the server
or user authentication failed.
[ISQL]ERROR: Could not SQLConnect
[root(at)jhbasterisk pg_log]#
---

If i check using psql:

---
[root(at)jhbasterisk pg_log]# psql -U username -d asteriskcdrdb
psql (9.4.4)
Type "help" for help.

asteriskcdrdb=> \d+
List of relations
Schema | Name | Type | Owner | Size |
Description
--------+----------------+----------+-----------------+------------+--------
-----
public | cdr | table | asteriskcdruser | 8192 bytes |
public | cdr_id_seq | sequence | asteriskcdruser | 8192 bytes |
public | cdr_leg | table | asteriskcdruser | 8192 bytes |
public | cdr_leg_id_seq | sequence | asteriskcdruser | 8192 bytes |
public | cel | table | asteriskcdruser | 8192 bytes |
public | cel_id_seq | sequence | asteriskcdruser | 8192 bytes |
(6 rows)

asteriskcdrdb=> \list
List of databases
Name | Owner | Encoding | Collate | Ctype |
Access privileges
---------------+----------+----------+-------------+-------------+----------
--------------------
asteriskcdrdb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
=Tc/postgres +
| | | | |
postgres=CTc/postgres +
| | | | |
asteriskcdruser=CTc/postgres
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
=c/postgres +
| | | | |
postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
=c/postgres +
| | | | |
postgres=CTc/postgres
(4 rows)

asteriskcdrdb=>
---

Tables cdr_leg, cdr and cel are in asteriskcdrdb.

Thanks for your continued assistance!

Kind regards,
--
Nick

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Stefan Viljoen 2015-07-20 06:52:35 Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client
Previous Message Faith, Jeremy 2015-07-17 16:27:56 Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client