r1901: updated with-database and connect/disconnect functions to work better with...