I’m writing a CFC on a server running Coldfusion MX 7. The CFC needs to be able to query a database the location of which will be determined at runtime. The database is SQL Server 2005. The CFC takes the IP address of the server and the name of the database as arguments, and the built-in Windows Authentication should allow connections from the machine. However, I can’t figure out how to code the connection. The <cfquery> tag hasn’t supported the connectstring attribute since CF5. Setting up a System DSN isn’t dynamic enough. I know there’s probably some way to connect to SQL Server without using a DSN, but the method escapes me at the moment. Does anyone know how to do this?
Share
You can modify the datasource on CF7 using the datasourceService. Something along these lines might work: