|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Two CFQUERY statements?
I have someone who has two separate databases and they want me to write a Web form generating option menus from both databases.Steven Sprouse 03/11/10 03:33 P You can happily query multiple databases within the same request; whatBarney Boisvert 03/11/10 03:37 P On Thu, Mar 11, 2010 at 3:35 PM, Barney Boisvert <bboisvert@gmail.com>wrote:Casey Dougall 03/11/10 03:39 P In SQL Server, not only can you cross join two databases in a single query,Bobby Hartsfield 03/12/10 08:07 A You'll have to excuse me, I'm still sort of a CF novice so I'm not too familiar with how to use CFTRANSACTION.Steven Sprouse 03/11/10 03:46 P ---- Steven Sprouse <ssprouse@ccboe.com> wrote:Roger Austin 03/11/10 03:58 P Sounds like ColdFusion is having problems connecting to one of yourEric Cobb 03/11/10 03:58 P Make sure the name you gave your datasource in the CF Administrator is theBobby Hartsfield 03/12/10 08:09 A That isn't true in the least, you can certainly have more than one dbLRS Scout 03/11/10 03:37 P I have someone who has two separate databases and they want me to write a Web form generating option menus from both databases. I have set up both as separate data sources in my Coldfusion administrator and have included one cfquery at the head of my document generating a list of locations. It's working fine. When I try to query the second database and do a cfoutput for another option menu, I get errors. I seem to remember that it might not be possible to have two separate cfquery statements in the same document. Is this correct? If so, how would I go about achieving my desired result? You can happily query multiple databases within the same request; what you can't do is query multiple databases within a single transaction. So as long as your CFQUERY tags don't share a CFTRANSACTION block you should be fine. Can you post the actual error message? cheers, barneyb On Thu, Mar 11, 2010 at 12:26 PM, Steven Sprouse <ssprouse@ccboe.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- On Thu, Mar 11, 2010 at 3:35 PM, Barney Boisvert <bboisvert@gmail.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- But you can't do it from within the same <cfquery> tag as they are separate data sources. So you need two queries and then a QoQ to link them together if need be. In SQL Server, not only can you cross join two databases in a single query, you can join them across separate servers/instances (provided they are linked servers). On Thu, Mar 11, 2010 at 3:35 PM, Barney Boisvert <bboisvert@gmail.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- But you can't do it from within the same <cfquery> tag as they are separate data sources. So you need two queries and then a QoQ to link them together if need be. You'll have to excuse me, I'm still sort of a CF novice so I'm not too familiar with how to use CFTRANSACTION. What I was doing was just putting two separate CFQUERY statements at the head of my document, each with a different name attribute and different data sources. When I did my cfoutput of the second cfquery, that's when I got my error. The error was "Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][DataDirect][ODBC SequeLink driver][SequeLink Server]The specified data source is not defined." But I'm not sure that is very helpful to you. If one of the databases was converted into a table and placed into the other database, I'd have no problem with this, but for some reason I'm getting tripped up with the different data sources. Thanks for any help you can offer. ----- Excess quoted text cut - see Original Post for more ----- ---- Steven Sprouse <ssprouse@ccboe.com> wrote: > If one of the databases was converted into a table and placed into the other database, I'd have no problem with this, but for some reason I'm getting tripped up with the different data sources. More than likely, this is a permissions issue on the other datasource or the datasource is not set up properly. -- http://www.linkedin.com/pub/roger-austin/8/a4/60 http://twitter.com/RogerTheGeek http://www.misshunt.com/ Home of the Clean/Dirty Magnet http://www.ncdevcon.com/ TACFUG 2010 Conference in North Carolina Sounds like ColdFusion is having problems connecting to one of your databases. Try this: 1) make sure you can "verify" both datasources in your ColdFusion Administrator. 2) make sure you didn't misspell one of the datasource names in your cfquery tags. thanks, eric cobb ecar technologies, llc http://www.cfgears.com Steven Sprouse wrote: ----- Excess quoted text cut - see Original Post for more ----- Make sure the name you gave your datasource in the CF Administrator is the same as the name you are using in the "name" attribute of your cfquery tag. CF Appears to think there is no datasource with the name you are trying to use. You'll have to excuse me, I'm still sort of a CF novice so I'm not too familiar with how to use CFTRANSACTION. What I was doing was just putting two separate CFQUERY statements at the head of my document, each with a different name attribute and different data sources. When I did my cfoutput of the second cfquery, that's when I got my error. The error was "Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][DataDirect][ODBC SequeLink driver][SequeLink Server]The specified data source is not defined." But I'm not sure that is very helpful to you. If one of the databases was converted into a table and placed into the other database, I'd have no problem with this, but for some reason I'm getting tripped up with the different data sources. Thanks for any help you can offer. ----- Excess quoted text cut - see Original Post for more ----- That isn't true in the least, you can certainly have more than one db queried in a request. I have to hit 3 or 4 just for authentication, single sign on, personnel records and other info that's spread all across the University I work for. What are the errors? Are you nesting queries outputs inside one another? If so that won't work, you have to use cfloop instead. I have someone who has two separate databases and they want me to write a Web form generating option menus from both databases. I have set up both as separate data sources in my Coldfusion administrator and have included one cfquery at the head of my document generating a list of locations. It's working fine. When I try to query the second database and do a cfoutput for another option menu, I get errors. I seem to remember that it might not be possible to have two separate cfquery statements in the same document. Is this correct? If so, how would I go about achieving my desired result?
|
July 31, 2010
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||