Skip to main content
Participant
June 9, 2012
Answered

cf administrator says connect to db is ok but web page says unable to find datasource.

  • June 9, 2012
  • 3 replies
  • 1492 views

I have been able to connect my mysql database to the coldfusion 10 administrator, using the mysql(4/5) driver.  However when I attempt to preform a query in a webpage I get an error page saying:


Datasource newsletter could not be found

Here is the code snippet:

<cfquery Name="dump" datasource="newsletter" username="root" password="*******">(my password is correct)

  select *

  from Newsletter

</cfquery>

<cfdump var=#dump#>

ANy help would be appreciated.

This topic has been closed for replies.
Correct answer G0ddessMother

I figured out what the issue was.

I had both Coldfusion 9 and Coldfusion 10 installed.  It appears I was getting the database connected with Coldfusion 9 but then I was building and running on the coldfusion 10 server.  Uninstalling coldfusion 9 and ensuring the datasource was connected to the coldfusion 10 administrator resolved the issue.

3 replies

G0ddessMotherAuthorCorrect answer
Participant
June 11, 2012

I figured out what the issue was.

I had both Coldfusion 9 and Coldfusion 10 installed.  It appears I was getting the database connected with Coldfusion 9 but then I was building and running on the coldfusion 10 server.  Uninstalling coldfusion 9 and ensuring the datasource was connected to the coldfusion 10 administrator resolved the issue.

BKBK
Community Expert
Community Expert
June 11, 2012

A curious one for the books! Please mark it as answered.

BKBK
Community Expert
Community Expert
June 10, 2012

You might be confusing the table name with the datasource name. Why don't you run the following code to verify the names of all the datasources:

<cfset adminObj = CreateObject("component","cfide.adminapi.administrator")>

<cfset adminLogin = adminObj.login("my_cfadmin_password")>

<cfset datasourceService = CreateObject("component","cfide.adminapi.datasource")>

<cfset datasources = datasourceService.getDatasources()>

<cfset datasourceList = structkeylist(datasources)>

List of datasources: <cfoutput>#datasourceList#</cfoutput>

Inspiring
June 9, 2012

It probably won't help, but try it without the username and password.  They are unnecessary.