my application hosted on central server serves many customers. needs cross-reference information database servers reside onsite @ customer's location.
i want store details of customer's server alongside account details (e.g dbname, host, port etc).
however depending on logged application, need supply data connection details <cfquery>
function in order perform lookups. this:
<cfquery name="rsorders" datasource="{dynamically provided connection string}"> select * companysdbtable </cfquery>
i understand there administrator api creates data source programmatically, using mean process in system , happen if data source details updated customer?
so there way on fly above? is, supplying data connection string within <cfquery>
tag.
or there better way of doing altogether?
you can create application-specific datasources @ runtime in coldfusion 11. see docs: "application-specific datasources in application.cfc". discuss in blog: "defining datasources in application.cfc".
an example be:
// application.cfc component { this.name = "dsntest02"; this.datasources = { scratch_mssql_app = { database = "scratch", host = "localhost", port = "1433", driver = "mssqlserver", username = "scratch", password = "scratch" }, scratch_embedded_app = { database = "c:\apps\adobe\coldfusion\11\full\cfusion\db\scratch", driver = "apache derby embedded" } }; this.datasource = "scratch_mssql_app"; }
that's closest can coldfusion.
if use jdbc directly, give connection string when creating connection, code need contend record sets returned jdbc driver, not cfml query objects.
Comments
Post a Comment