Skip to main content
Inspiring
April 15, 2013
Answered

DataSource

  • April 15, 2013
  • 2 replies
  • 534 views

I can use Application.Datasource to assign a datasource for the application.

I would like to know the web site can only has one datasource.

If my web site has more than one database on the different database server then am I able to assign the second datasource for the application or I need to assign every time if I have more than one datasource for the application,

Your help and information is great appreciated,

Regards,

Iccsi

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Correct answer duncancumming

    You can have multiple datasources in your application.  Create each one in your CF Admin > Datasources.  Then in onApplicationStart in your application.cfc, just create each one, e.g.

    <cfset application.customerDSN = "Customer_Datasource">

    <cfset application.supplierDSN = "Supplier_Datasource">

    Which you can then refer to in your queries or stored procedures:

    <cfstoredproc datasource="#application.supplierDSN#">

    2 replies

    duncancummingCorrect answer
    Participating Frequently
    April 15, 2013

    You can have multiple datasources in your application.  Create each one in your CF Admin > Datasources.  Then in onApplicationStart in your application.cfc, just create each one, e.g.

    <cfset application.customerDSN = "Customer_Datasource">

    <cfset application.supplierDSN = "Supplier_Datasource">

    Which you can then refer to in your queries or stored procedures:

    <cfstoredproc datasource="#application.supplierDSN#">

    iccsiAuthor
    Inspiring
    April 15, 2013

    Thanks a million for helping,

    Regards,

    Iccsi