refactor how database connections are created

sql.Open is now called once only, when config is set, which sets up the connection pool. The database is now stored in a global variable. The configuration object read by the caller has all the connection properties.
refactor DB into package and simplify

making the database and metadata globals on the assumption that they are shared across all requests, and one database, means we can get rid of the concept of DBContext.