Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Script for Local Development to setup coldfusion datasources
<cfscript>
writeOutput('starting db source installation...<br/ >');
function createDSN( name ) {
// Login is always required. This example uses two lines of code.
adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login("pete", "admin");
// Instantiate the data source object.
myObj = createObject("component","cfide.adminapi.datasource");
// Create a DSN.
myObj.setMYSQL5(
name="dsn#ARGUMENTS.name#",
host="127.0.0.1",
database=ARGUMENTS.name,
username="pete",
password="pete"
);
writeOutput('<br />created #ARGUMENTS.name# datasource');
}
arr_names = [
'books',
'authors'
];
for( name in arr_names ) {
createDSN( name );
}
writeOutput('<br />completed');
</cfscript>
@Willshaw

This comment has been minimized.

Copy link
Owner Author

Willshaw commented Mar 31, 2017

I need to check my chrome history to find the person who's code I modified to make this - credit must be given

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.