Checkout the new york times dbslayer that they have on
http://code.nytimes.com/projects/dbslayer
from their description:
The DBacesslayer aka DBSlayer aka Släyer (as we like to call it when
we're feeling ironically heavy metal) is a lightweight database
abstraction layer suitable for high-load websites where you need the
scalable advantages of connection pooling. Written in C for speed,
DBSlayer talks to clients via JSON over HTTP, meaning it's simple to
monitor and can swiftly interoperate with any web framework you choose.