Thread: Connection to a unix domain socket

Connection to a unix domain socket

From
Klaus Reimer
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I can connect via ODBC over TCP/IP to my postgresql database and I connect
WITHOUT ODBC over a Unix Domain socket to this database, but how can I
connect via ODBC over a Unix Domain socket to the database? It doesn't matter
what filename I specify with the SOCKET-Option. The connection is always made
but as soon as I exec a query I get this error message:

SQLAllocStmt: ErrorSQL error state code: 08003
[iODBC][Driver Manager]Connect not open

I think I specified the wrong ODBC Options. To connect via TCP/IP I use these
options:

DRIVER=/usr/lib/libodbcpsql.so.1
SERVER=localhost
PORT=5432
UID=xxxxxxxxx
PWD=xxxxxxxxx
DATABASE=test
ReadOnly=0

This is working fine. Now I tried to just remove the SERVER and PORT Options
to make a socket connection and I tried to specifiy this additional option:

SOCKET=/var/run/postgresql/.s.PGSQL.5432

But both tries failed with the above error message. I also wonder why the
SQLDriverConnect() isn't showing any errors. But SQLAllocStmt() says there is
no connect. The same code used with a mysql database (over unix-domain socket
specified with the SOCKET option) works fine.

Any hints? Please answer directly to my mail address, I am not subscribed to
the list.

- --
Bye, K
[a735 47ec d87b 1f15 c1e9 53d3 aa03 6173 a723 e391]
(Finger k@ailis.de to get public key)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE60dGZqgNhc6cj45ERAtglAKDkCC6+G4aBp+12bos4YvCxen3yQACeNrpQ
+5n2TXOsy7SrGuM0PUp7qTY=
=lXLe
-----END PGP SIGNATURE-----

Re: Connection to a unix domain socket

From
Hiroshi Inoue
Date:
Klaus Reimer wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I can connect via ODBC over TCP/IP to my postgresql database and I connect
> WITHOUT ODBC over a Unix Domain socket to this database, but how can I
> connect via ODBC over a Unix Domain socket to the database?

Unfortunately you couldn't connect over a Unix Domain socket
using current psqlodbc driver.

[snip]

>
> This is working fine. Now I tried to just remove the SERVER and PORT Options
> to make a socket connection and I tried to specifiy this additional option:
>
> SOCKET=/var/run/postgresql/.s.PGSQL.5432
>

The *SOCKET* option is intended to specify socket buffer size
not the name of socket file.

regards,
Hiroshi Inoue