Skip navigation
G0ddessMother
Currently Being Moderated

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

Jun 9, 2012 7:05 AM

Tags: #cfquery #coldfusion #sql #cf10

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.

 
Replies
  • Currently Being Moderated
    Jun 9, 2012 3:30 PM   in reply to G0ddessMother

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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 10, 2012 10:17 AM   in reply to G0ddessMother

    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>

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2012 10:56 AM   in reply to G0ddessMother

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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points