Avatar of WestCoast_BC
WestCoast_BC
Flag for Canada asked on

Error querying table in multiple databases

I am trying to query the same table in multiple databases.  When my code attempts to query the second database in my list I get the following error:
        Datasource DB1 could not be found.

If I change the order in my DSNList my code always fails at the second database.  
<cfset DSNList = "db1, db2, db3">

<cfloop list="#DSNList#" index="defDSN" delimiters=",">
	<cfoutput>
	[#defDSN#]:
	</cfoutput>
	<CFQUERY NAME="getCategory" DATASOURCE="#defDSN#">
		SELECT      *
		FROM        thread_categories
	</cfquery>
	
	<br />
</cfloop>

Open in new window

ColdFusion LanguageMySQL Server

Avatar of undefined
Last Comment
WestCoast_BC

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
js_vaughan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
WestCoast_BC

ASKER
Thank you!  I wish I had figured that out an hour ago.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck