This is the function that I wrote when I execute it the datasource shows up in the administrator but when i try to verify it there is an error. The administrator knows the name of the datasource and where the file is but it just doesn't recognize it as a registered datasource.

<cffunction name="createDemobuilder_DataSources" hint="Creates a new datasource" returntype="boolean">
<cfargument name="DSN" required="yes" type="string">
<cfargument name="DBPATH" required="yes" type="string">

<cfscript>
factory = CreateObject("java", "coldfusion.server.ServiceFactory");

datasources = factory.datasourceservice.getDataSources();
</cfscript>

<cfset datasourcecopy = Duplicate(datasources['DemoBuilderDefaultDB'])>

<cfset datasourcecopy.name = "#DSN#">
<cfset path="#DBPATH#\#DSN#.mdb">
<cffile action="" source="#Request.Source.dbpath#" destination="#path#">
<cfset datasourcecopy.urlmap.databasefile = "#path#">
<cfset datasourcecopy.url = ""> <cfset datasourcecopy.urlmap.connectionprops.datasource = "#DSN#">
<cfdump var="#datasourcecopy#">
<cfset datasources['#DSN#'] = Duplicate(datasourcecopy)>

<cfdump var="#datasources#">
<cftry>
<cfset valid = factory.datasourceservice.verifydatasource(arguments.DSN)>
<cfcatch type="any">
<cfset valid="false">
</cfcatch>
</cftry>

<cfreturn valid>
</cffunction>

I tried adding the store and restart methods but I still got the same error. I also tried the method you used (with a minor change for ms access) but sadly, the same error.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to