Copy link to clipboard
Copied
Hi,
I'm migrating an application from CF CF 8 to 10, but I have a problem that is stopping me
The following code is correct and works in CF 8
<cdscript>
.
.
.
DataSourceFactory = CreateObject("java","coldfusion.sql.DataSourceFactory");
DataSourceFactory.getInstance().getDataSource(Attributes.datasource).getConnection();
.
.
</cfscrip>
But in CF 10 marks the next error.
struct
Detail Either there are no methods with the specified method name and argument types or the getDataSource method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
Message The getDataSource method was not found.
MethodName getDataSource
StackTrace coldfusion.runtime.java.MethodSelectionException: The getDataSource method was not found. at coldfusion.runtime.java.ObjectHandler.findMethodUsingCFMLRules(ObjectHandler.java:383) at coldfusion.runtime.StructBean.invoke(StructBean.java:524) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2465) at cfjdbcquery_open2ecfm1678258463.runPage(C:\ColdFusion10\cfusion\wwwroot\sif\TagsSIF\jdbcquery_open.cfm:64) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244) at coldfusion.filter.CFVariablesScopeFilter.invoke(CFVariablesScopeFilter.java:56) at coldfusion.tagext.lang.ModuleTag.doAfterBody(ModuleTag.java:377) at
Any Idea?
Copy link to clipboard
Copied
I think the DataSourceFactory is an undocumented internal ColdFusion library, which Adobe discourages using (because it is undocumented and subject to change between versions). It apparently was removed or changed substantialy between CF8 and CF10 (might even have happened with CF9). You would be better off using the CF Administrator API. There is a portion of the API that deals with datasources. Here are the Adobe docs for the API: http://help.adobe.com/en_US/ColdFusion/10.0/Admin/WSc3ff6d0ea77859461172e0811cbf364104-7fcf.html.
-Carl V.