开发者

Check if Database Exists -- Engine Agnostic

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?


Do you mean the server or a specific database?

Whatever the answer to that question - Sure there is, just use the "DoesDBExist" function of my framework. I have it in many different languages and platforms; do you need Android or C#.Net or some other? But first, you need to snatch this pebble from my hand...

What you have is all there is, I'm afraid.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜