db: don't use global Session

Now the API supports remote databases, and reconnects in case of
failures.
handler: using proper environment variables in bind