Re: Is there a way to test to see if a data source exists?

2003-06-27 Thread CF Dude
Couldn't you do something like this? (not exact code) cftry cfquery datasource=#DoesThisExist# select * from table where 1 = 2 /cfquery cfcatch type=Database Something broker /cfcatch /cftry Just an idea. E - Original Message - From: Stan Winchester

RE: Is there a way to test to see if a data source exists?

2003-06-27 Thread Barney Boisvert
You should be able to run a query that you know will fail on the DSN within a CFTRY..CFCATCH block, and then look at the error message to determine what kind of failure it was: invalid DSN or something else. barneyb --- Barney Boisvert, Senior Development Engineer AudienceCentral [EMAIL

RE: Is there a way to test to see if a data source exists?

2003-06-27 Thread Lofback, Chris
These are CF 5 solutions. Try the undocumented CFIF CF_IsColdFusionDataSource(MyDSN) or if you prefer a supported option you could try something like this: CFSET DSN = Foo CFSET DSNType = ODBC CFTRY !--- Query should always fail and go to CFCATCH --- CFQUERY NAME=Test

Re: Is there a way to test to see if a data source exists?

2003-06-27 Thread CF Dude
I'm sure you would have come up with it. If this is cf 4x, you could use BenForta's connection tag that does a reg query and find the currently created dsns. I wish I knew what that was called. - Original Message - From: Stan Winchester [EMAIL PROTECTED] CF Dude, I should have

RE: Is there a way to test to see if a data source exists?

2003-06-27 Thread Jim Davis
Assuming CFMX (version matters) you could use the stuff described here to do it quite easily: http://spike.oli.tudelft.nl/jochemd/index.cfm?PageID=12 Using TRY/CATCH is a good idea as well, but you'll need to determine a good query to use: you want to make sure that the datasource doesn't exist

Re: Is there a way to test to see if a data source exists?

2003-06-27 Thread CF Dude
I consider the right query as an obvious, but now I do have another question. What would happen if, in this scenario, you just used an empty cfquery tag? EG : cftry cfquery datasource=#doesThisExist# /cfquery cfcatch type=database What would happen if no query was

RE: Is there a way to test to see if a data source exists?

2003-06-27 Thread Jim Davis
You get a no SQL specificied error - CF won't try to make a connection for no reason. Jim Davis -Original Message- From: CF Dude [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 2:39 PM To: CF-Talk Subject: Re: Is there a way to test to see if a data source exists? I

Re: Is there a way to test to see if a data source exists?

2003-06-27 Thread CF Dude
That makes sense. - Original Message - From: Jim Davis [EMAIL PROTECTED] You get a no SQL specificied error - CF won't try to make a connection for no reason. Jim Davis ~| Archives:

RE: Is there a way to test to see if a data source exists?

2003-06-27 Thread Jim Davis
-Original Message- From: CF Dude [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 2:39 PM To: CF-Talk Subject: Re: Is there a way to test to see if a data source exists? I consider the right query as an obvious, but now I do have another question. I'm not sure why it would

RE: Is there a way to test to see if a data source exists?

2003-06-27 Thread Bryan Love
on Windows you can check the registry: CFREGISTRY ACTION=GETALL NAME=DS_ODBC_List TYPE=ANY BRANCH=HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources cfset DSNnames = valueList(DS_ODBC_LIST.entry)

Re: Is there a way to test to see if a data source exists?

2003-06-27 Thread CF Dude
I'm not sure why it would be an obvious - are you talking about a specific database with known tables, or just an unknown datasource? Yes. I really can't imagine anybody building a web app that will give a user the option of connecting to some random unknown datasource. Know what I mean? I

RE: Is there a way to test to see if a data source exists?

2003-06-27 Thread Taco Fleur
I guess you would just make a call to the datasource within a cftry block and catch the error with cfcatch if it does not exist.. -Original Message- From: CF Dude [mailto:[EMAIL PROTECTED] Sent: Saturday, 28 June 2003 12:12 PM To: CF-Talk Subject: Re: Is there a way to test to see if a