Access PostgreSQL trough sockets

Hi,

Is it possible to write and read records in a PostgreSQL database? Actually I would like to write a C program that would read sockets and then write to a PostgreSQL database and reverse, to read from PostgreSQL database and to send sockets to some TCP/IP address.

Thanks in advance.
 
You would link your C program against the libpq C library of PostgreSQL. The documentation of which can be found in Chapter 31 of the PostgreSQL Manual.

At the end of that Chapter you will find programming examples.

If you don't assign a host name in the PQconnectdb() function, then your C program connects to the socket of the locally running postgres instance. Although, you can use the same program to connect to a PostgreSQL server on any other host, by only specifying a respective host name.

I found myself quickly comfortable with the very well documented libpq.
 
Back
Top