Skip to main content
Participating Frequently
February 13, 2012
Question

Datasource could not be found when it definitely should be

  • February 13, 2012
  • 2 replies
  • 7553 views

Hi

We are getting the error "Datasource [NameOfDatasource] could not be found" for a particular CF datasource and can't work out why.  A restart of CF resolves the error as does deleting the datasource and recreating it with the exact same properties.  This started happening a couple of months after installing CF. 

The server is CF 9.0.1 running on Win 2008 R2 (SP1) 64-bit.

The database and port the datasource connects to is definitely correct, so this is not the issue.  We thought it may be an issue with the "Maintain connections across client requests" setting not maintaining a connection, but the issue still occurs even with this option turned off.

We create the datasource via code by making a copy of an existing 'template' datasource (using duplicate) and then setting properties of the copy.  We use coldfusion.server.ServiceFactory.DataSourceService.DataSources to get the template datasource and to add the new datasource.  We are investigating how to create the datasource from scratch using the Admin API (cfide.adminapi.administrator) rather than using the template to see if this resolves the issue, but in the meantime thought we would post to the forums to see if anyone can work out why its failing.

I created another post here that may be related whereby scheduled tasks are running several times daily when they shouldn't be.  I don't know if these are related but they seemed to have started happening around the same time.

I didn't know whether this should be classed as a 'Question' or not, so ticked it just in case.

Thanks

Nathan

This topic has been closed for replies.

2 replies

Tim Cunningham
Participating Frequently
January 7, 2013

Out of curiosity, what did you name the datasource?

BKBK
Community Expert
Community Expert
February 13, 2012

Two vital questions remain unanswered:

1) Did you initially create the datasource in the ColdFusion Administrator?

2) What is the type and version of the database engine?

N DruryAuthor
Participating Frequently
February 13, 2012

Hi BKBK

The 'template' datasource we duplicate to create the datasource was created using the CF Administrator.  Interestingly, there are many other datasources that follow the same creation process (i.e. use the template) but which are not having a problem.

We modified the code last night to use cfide.adminapi.datasource to create the datasource rather than the template and the issue happened again last night.

The DB is SQL Server 2008 R2.

Thanks

Nathan

BKBK
Community Expert
Community Expert
February 14, 2012

It still sounds much too complex to me. My point is, do nothing with (that is, comment out) the cfide.adminapi.datasource code. Just follow the steps to create an SQL Server datasource in the ColdFusion Administrator. What happens then?