The ColdFusion Administrator organizes information about all ColdFusion server database connections in a single location. In addition to adding data sources, you can use the Administrator to specify changes to your database configuration, such as relocation, renaming, or changes in security permissions.
You use the ColdFusion Administrator to quickly add a data source for use in your ColdFusion applications. When you add a data source, you assign it a data source name (DSN) and set all information required to establish a connection.
To add a data source,
-
- In the Database field, enter the name of the database.
- In the Server field, enter the network name or IP address of the server that hosts the database, and enter any required Port value. For example, the bullwinkle server on the default port.
- If your database requires login information, enter your user name and password.
For more information on creating dat asources, see Data Source Management for ColdFusion.
In ColdFusion, there are Admin APIs available through which developers can add, modify, and delete Admin task programmatically. This is helpful for developers who do not have access to ColdFusion Administrator, for example, component event gateway, data sources, mail, and so on.
To access the Admin APIs, enable RDS.
To enable RDS, click Security > RDS and enable the option Enable RDS Service.
ColdFusion provides MSSQL driver in both Standard and Enterprise editions. This example is with Macromedia drivers:
<cfscript> // Login is always required. This example uses two lines of code. adminObj = createObject("component","cfide.adminapi.administrator"); adminObj.login("PASSWORD"); //CF admin password. // Instantiate the data source object. myObj = createObject("component","cfide.adminapi.Data Sources"); // Create a DSN. myObj.setOther(driver="macromedia.jdbc.MacromediaDriver", url="jdbc:macromedia:sqlserver://localhost:1433;databaseName=CaseResolution", class="macromedia.jdbc.MacromediaDriver", name="jd", login_timeout = "29", timeout = "23", interval = 6, buffer = "64000", blob_buffer = "64000", setStringParameterAsUnicode = "false", description = "JD", pooling = true, maxpooledstatements = 999, enableMaxConnections = "true", maxConnections = "299", disable_clob = true, disable_blob = true, disable = false, storedProc = true, alter = false, grant = true, select = true, update = true, create = true, delete = true, drop = false, revoke = false ); </cfscript>
For more information, see Data sources in ColdFusion Admin API reference.