Hi all, were having a small issue in attempting to create CFMX datasources
programatically. Has anyone managed to do this? Were running Win2k Adv
Server on MX with Updater 2 applied.
Using the following code where.....
* sample_ds is the database used to clone a new database
* #cf_ds_name# is the name of the new cf database
* #odbc_ds_name# is name of the ODBC DSN, which references an
Excel spreadsheet
Result...
* Datasource appears in Cold Fusion administrator
* The correct ODBC DSN is shown
* All variables are correct
But ....
* Datasource does not verify, you get this beauty..
Connection verification failed for data source: xl_ds_2119962272
[]java.sql.SQLException: SQLException occurred in JDBCPool while attempting
to connect, please check your username, password, URL, and other
connectivity info.
The root cause was that: java.sql.SQLException: SQLException occurred in
JDBCPool while attempting to connect, please check your username, password,
URL, and other connectivity info.
And...
* When you change the name of the datasource, and Submit, it is
verified correctly (presumably having forced some code to execute)
* Still works when you then change the datasource name back to the
original
* <dump>ing the datasource structure before and after gives an
identical result
So....
* Is there some additional code required to boot the datasource ?
Code...
<!--- Create Cold Fusion Datasource --->
<cflock name="serviceFactory" type="exclusive" timeout="10">
<cfscript>
// Get a handle on datasources structure
objFactory = CreateObject("java",
"coldfusion.server.ServiceFactory");
objService = objFactory.getDataSourceService();
dsources = objService.getDatasources();
// Get a copy of the generic ds, configure, add to
datasources
local_ds = Duplicate(dsources['sample_ds']);
local_ds.name = "#cf_ds_name#";
local_ds.url = Replace(ds_copy.url,"sample_ds",cf_ds_name);
local_ds.urlmap.datasource = "#odbc_ds_name#";
local_ds.urlmap.connectionprops.datasource =
"#cf_ds_name#";
local_ds.valid = "YES";
dsources["#cf_ds_name#"] = Duplicate(local_ds);
objService.restart();
</cfscript>
</cflock>
Any advice on how to procede further would be cool :)
Mikey
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4