Change creation of the Database object to EAFP. LBYL is impossible with HTTP and no locking. If create-flag is set, then go do it and swallow an exception about it already existing. (LP: #707321)
In addition, simplify that code so it makes fewer round-trips to the server.