Improved sql backend.

Made sql backend use one persistant connection throughout, instead of
opening a new one each time a method is called. Adds a Close method to
cleanup.
documenting