pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Connect to a PostgreSQL-Server by TCP/IP
4+ messages / 4 participants
[nested] [flat]

* Connect to a PostgreSQL-Server by TCP/IP
@ 2005-06-22 15:37 Fischer Ulrich <ulrich.fischer@aerodynamics.ch>
  2005-06-22 15:51 ` Re: Connect to a PostgreSQL-Server by TCP/IP Tom Lane <tgl@sss.pgh.pa.us>
  2005-08-10 10:38 ` Re: Connect to a PostgreSQL-Server by TCP/IP Tomasz Myrta <jasiek@klaster.net>
  0 siblings, 2 replies; 4+ messages in thread

From: Fischer Ulrich @ 2005-06-22 15:37 UTC (permalink / raw)
  To: pgsql-interfaces

Hello

I'm new in this List.
I would like to connect to a Postgres-Server by a LabView-Client. The 
problem is, there is NO odbc-driver for LV on Linux and no LV-interface 
to postgreSQL.
So I decided to make my own simple LabView driver. Are there some docs, 
which describes the basic communication over a tcp connection between 
the postgres server and a client? I'm interested in 'message 
architecture' (header, data for login, sql-querys and so on...) and all 
this stuff.
I tried some backward engineering by sniffing the tcp connection, but it 
is rather anoying. It looks like the messages have some binary headers 
and they are a problem....

Has anybody an idea? Thanks for your help!!!

Regards
Ulrich

Sniffing the communication between a running perl-script (DBI) and postgres:

open tcp connection ..ok
client request .......296 bytes (???)
Postgres response ....1 byte (4e)
client request .......296 bytes (including dbname username in
                       ascii)
Postgres response ....5 bytes (52 00 00 00 03)
client request .......14 bytes (including password in ascii)
Postgres response ....15 bytes (52 00 00 00 00 4b  00 00 78 6f 0c 43 eb 
70 5a)
client request .......44 bytes (Qbegin ; select getdatabaseencoding();
                       commit)
Postgres response ....79 bytes (CBEGIN Pblank getdatabaseencoding
                       SQL_ASCIICSELECT CCOMMIT)
client request .......60 bytes (Qselect pid, name, vorname from
                       mitarbeiter where pid= 'fiu')
Postgres response ....96 bytes (Pblank pid name Dvorname fiu Fischer
                       UlrichCSELECT)
client request .......1 byte (58)



-- 
Ulrich G. Fischer                       Dipl. Natw. ETH
Center Aerodynamics                     Ruag Aerospace
P.O. Box 301                            CH-6032 Emmen
Tel. +41 41 268 23 53                   Fax. +41 41 268 38 97
ulrich.fischer@aerodynamics.ch          www.ruag.com



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Connect to a PostgreSQL-Server by TCP/IP
  2005-06-22 15:37 Connect to a PostgreSQL-Server by TCP/IP Fischer Ulrich <ulrich.fischer@aerodynamics.ch>
@ 2005-06-22 15:51 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2005-06-22 15:51 UTC (permalink / raw)
  To: Fischer Ulrich <ulrich.fischer@aerodynamics.ch>; +Cc: pgsql-interfaces

Fischer Ulrich <ulrich.fischer@aerodynamics.ch> writes:
> So I decided to make my own simple LabView driver. Are there some docs, 
> which describes the basic communication over a tcp connection between 
> the postgres server and a client?

http://www.postgresql.org/docs/8.0/static/protocol.html

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Connect to a PostgreSQL-Server by TCP/IP
  2005-06-22 15:37 Connect to a PostgreSQL-Server by TCP/IP Fischer Ulrich <ulrich.fischer@aerodynamics.ch>
@ 2005-08-10 10:38 ` Tomasz Myrta <jasiek@klaster.net>
  2005-08-10 18:30   ` Re: Connect to a PostgreSQL-Server by TCP/IP John DeSoi <desoi@pgedit.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Tomasz Myrta @ 2005-08-10 10:38 UTC (permalink / raw)
  To: pgsql-interfaces

Fischer Ulrich napisal 2005-06-22 17:37:
> Hello
> 
> I'm new in this List.
> I would like to connect to a Postgres-Server by a LabView-Client. The 
> problem is, there is NO odbc-driver for LV on Linux and no LV-interface 
> to postgreSQL.
> So I decided to make my own simple LabView driver. Are there some docs, 
> which describes the basic communication over a tcp connection between 
> the postgres server and a client? I'm interested in 'message 
> architecture' (header, data for login, sql-querys and so on...) and all 
> this stuff.
May I ask you, why do you want to make your own direct TCP connection to 
PostgreSQL? I think, in your case it would be much easier to create some 
wrapper for libpq or some other frontend library. It needs less work and 
you don't have to be afraid about tracking internal protocol changes.

> I tried some backward engineering by sniffing the tcp connection, but it 
> is rather anoying. It looks like the messages have some binary headers 
> and they are a problem....
Maybe source code of common used PostgresSQL frontends like libpq will 
help you?

Regards,
Tomasz Myrta



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Connect to a PostgreSQL-Server by TCP/IP
  2005-06-22 15:37 Connect to a PostgreSQL-Server by TCP/IP Fischer Ulrich <ulrich.fischer@aerodynamics.ch>
  2005-08-10 10:38 ` Re: Connect to a PostgreSQL-Server by TCP/IP Tomasz Myrta <jasiek@klaster.net>
@ 2005-08-10 18:30   ` John DeSoi <desoi@pgedit.com>
  0 siblings, 0 replies; 4+ messages in thread

From: John DeSoi @ 2005-08-10 18:30 UTC (permalink / raw)
  To: Tomasz Myrta <jasiek@klaster.net>; +Cc: pgsql-interfaces


On Aug 10, 2005, at 6:38 AM, Tomasz Myrta wrote:

> Fischer Ulrich napisal 2005-06-22 17:37:
>
>> Hello
>> I'm new in this List.
>> I would like to connect to a Postgres-Server by a LabView-Client.  
>> The problem is, there is NO odbc-driver for LV on Linux and no LV- 
>> interface to postgreSQL.
>> So I decided to make my own simple LabView driver. Are there some  
>> docs, which describes the basic communication over a tcp  
>> connection between the postgres server and a client? I'm  
>> interested in 'message architecture' (header, data for login, sql- 
>> querys and so on...) and all this stuff.
>>
> May I ask you, why do you want to make your own direct TCP  
> connection to PostgreSQL? I think, in your case it would be much  
> easier to create some wrapper for libpq or some other frontend  
> library. It needs less work and you don't have to be afraid about  
> tracking internal protocol changes.
>
>
>> I tried some backward engineering by sniffing the tcp connection,  
>> but it is rather anoying. It looks like the messages have some  
>> binary headers and they are a problem....
>>
> Maybe source code of common used PostgresSQL frontends like libpq  
> will help you?


PostgreSQL has a very nice and well documented protocol. See

http://www.postgresql.org/docs/8.0/static/protocol.html





John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-08-10 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-22 15:37 Connect to a PostgreSQL-Server by TCP/IP Fischer Ulrich <ulrich.fischer@aerodynamics.ch>
2005-06-22 15:51 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-08-10 10:38 ` Tomasz Myrta <jasiek@klaster.net>
2005-08-10 18:30   ` John DeSoi <desoi@pgedit.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox