Discussion Area

ask questions, discuss topics, solve problems

This is a public Discussion Area  publicRSS

Thread

    • Coldfusion with multiple databases
      Thread posted Jun 10 by cafcoder
      457 Views, 3 Comments
      Title:
      Coldfusion with multiple databases
      Content:

      Hi all,

              Suppose an application needs to access two databases, and join the recordsets of both databases for a purpose. If this is so, there are two options to do this

      1 in a single cfquery, make all operations like joins and all to achieve  to get the required result.

      2 make two cfqueries, one for each databases, and use query of query concept to get the desired result

      If above ones are the options, which option do we implement and why?

      Thanx in advance...

    Comments

    • Option 2 should work, becuase as far i know coldfusion can only use one database for a single query statement.

    • I have faced a similar scenario and tried implementing the option #2 as mentioned here.

      But my requirement was to do a Left Outer Join of the recordset which I was not able to do in a CFQUERY.

      So, I had to write a view in the database level to join the tables across the databases and select from that View.

    • I hope, First comment in below blog entry will help u. We can use 2 DB or datasource in a single cfquery. :)

      http://www.bennadel.com/blog/1146-Datasource-Names-For-All-The-Database-Tags-Within-CFTRANSACTION-Must-Be-The-Same.htm