Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jun 09, 2012 Jun 09, 2012

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.

TOPICS
Database access
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

New Here , Jun 11, 2012 Jun 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.

Translate
LEGEND ,
Jun 09, 2012 Jun 09, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2012 Jun 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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 11, 2012 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2012 Jun 11, 2012
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources