Siag Office

Shohei Mail

Webresolve

Pen

Dwatch

XMagick

Myhtml

Simple Database Library

Sdbsiod

mod_log_sdb

mod_sql_sdb

Sdbgrey

Ulric's Router Construction Kit

neXtaw

Mowitz

Kylie

O3read

Ucron

Parsecgi

Mr Big


Ulric's stuff


IPv6 Certification Badge for ulriceriksson
 

Proxy Daemon

Sometimes linking directly with the library isn't practical, perhaps because an application is being distributed in binary form and there's no way to know what database will be used, or perhaps the application will be run on a different machine from where the database client libraries are installed.

Sdbd to the rescue! This is a proxy daemon which handles the database communication on behalf of the application. As a result, there is no need for the application to be linked to database libraries or even libsdb itself; all that is handled by sdbd.

An example client is provided in sdbd_client.c. It is very similar to sdb_client, except that it doesn't use any libsdb calls. Example:

ulric@host1$ sdbd 2222

ulric@host2$ sdbd_client host1 2222 postgres:host=host1:db=testdb
sdbd> select * from foo
Matilda Eriksson 
Ulric Eriksson 
Joel Eriksson 
sdbd> 
In this case, the database, the client libraries and libsdb are all installed on host1. Nothing except sdbd_client is needed on host2.

Description of the protocol, as seen on the wire:

  1. Client sends url
  2. Server sends single space as acknowledgement
  3. Client sends query string
  4. Server sends number of columns in result, space-terminated
  5. Server sends column size in bytes, space-terminated
  6. Server sends column contents
  7. 5-6 are repeated for all additional columns
  8. 4-7 are repeated for all additional result rows
  9. Server sends the number 0.
Everything is sent in ascii form, so it can be debugged by humans. Example:
sh-2.05$ telnet localhost 2222
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
postgres:host=localhost:db=testdb
 select * from foo
2 7 Matilda8 Eriksson2 5 Ulric8 Eriksson2 4 Joel8 Eriksson0
Connection closed by foreign host.
                                                                                                                                                                                                                                                                               
 

Valid HTML 4.01! Powered By ...?
Google