[thelist] CF: Determining which DB used.

Bruce Heerssen bruce at heerssen.com
Wed Sep 12 09:16:42 CDT 2001


Frank wrote:

> 
> Hi,
> 
> The apps I write are cross platform, thus different DBs come into 
> play. Access or SQL 7 on PC, and MySQL on Linux. Is there a way of 
> automatically determining what database I'm using without having to 
> resort to creating a global variable and changing it every time I move 
> my app? It's a little thing that would make the transitions smoother.

Raymond is right (of course), you should be able to write your app in 
such a manner that it is portable, but if you must know which database 
you are using, then use cftry/cfcatch around two queries - one which 
works in MS SQL only, and one which works in MySQL only, whichever one 
doesn't fail is the database in force, so set a variable based on that.

You're on your own with the proprietary SQL though.

Good Luck

Bruce





More information about the thelist mailing list