I know, I know…I did not even want to ask the question because I think there is no way to do besides the “try and miss” approach (try to make a query to the db and catch the error/exception if does not exists) but I felt like asking the pros.
So, is there a way, non db-engine dependent, to check if a db exists?
Standard SQL assumes that there is already a connection to a specific database. So the only way to find out if a database exists lives outside standard SQL. For example there is no CREATE DATABASE statement in standard SQL.