> Julia,
>
> Can you post your code?
>
> Here's a sql-server specific function I use:
>
> <!--- Public Void addSqlDatasource(String Template, String Dsn,
> String
> Server, String Database, String Username, String Password) --->
> <cffunction access="public" returnType="void" name="addDatasource"
> output="false" hint="Creates a new datasource, using an existing
> datasource as a template.">
> <cfargument name="template" required="true" type="string">
> <cfargument name="dsn" required="true" type="string">
> <cfargument name="server" required="true" type="string">
> <cfargument name="database" required="true" type="string">
> <cfargument name="username" required="true" type="string">
> <cfargument name="password" required="true" type="string">
>
> <cfscript>
> // create the service factory, you can find loads of cool stuff
> here.. worth an explore :)
> var factory = CreateObject("java","coldfusion.server.
> ServiceFactory");
> // the Datasource Service
> var dsnService = factory.dataSourceService;
> // look at the existing datasources
> var datasources = dsnService.datasources;
>
> // copy an existing datasource
> var newdsn = duplicate(datasources[arguments.template]);
> newdsn.url = ""> > server#;databaseName=#arguments.
database#;SelectMethod=> direct;sendStringParametersAsUnicode=false;MaxPooledStatements=1000";
> newdsn.urlmap.connectionprops.database = arguments.database;
> newdsn.urlmap.connectionprops.host = listFirst(arguments.server,
> ":");
> newdsn.urlmap.database = arguments.database;
> newdsn.urlmap.host = listFirst(arguments.server, ":");
> newdsn.urlmap.port = listLast(arguments.server, ":");
> newdsn.username = arguments.username;
> newdsn.password = dsnService.encryptPassword(arguments.password);
> newdsn.name = arguments.dsn;
>
> // insert new datasource into the struct and modify
> datasources[arguments.dsn] = newdsn;
>
> // store and restart the service
> dsnService.store();
> dsnService.restart();
> </cfscript>
</cffunction>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

