开发者

Coldfusion Connection Code

开发者 https://www.devze.com 2022-12-16 16:06 出处:网络
开发者_JAVA技巧OK, Ive got my site all up - just not working. ahah. I need (I think) the correct code for a connection string to my database etc. I\'m using ColdFsuion and Mysql. My code for the conne
开发者_JAVA技巧

OK, Ive got my site all up - just not working. ahah. I need (I think) the correct code for a connection string to my database etc. I'm using ColdFsuion and Mysql. My code for the connection string is as follows:

<CFQUERY 
  NAME="cfGossip" 
  DATASOURCE="mysqlcf_bridgettip" 
  USERNAME="<bridgettip>" 
  PASSWORD="<*******>"
>
</CFQUERY>

My DNS on my hosting plan is, well I think is - mysqlcf_bridgettips and on my ColdFusion is cfGossip. I'm not sure which one to use, or if it's even one of them...? It says the error is there when I try access my index.cfm page.

The error over all is :

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be 
displayed.

Is it the connection string that is wrong? I would really love any help at all - rewriting my string etc.


Typically ColdFusion is easier to handle by adding datasources via the ColdFusion Administrator: See Adding Data Sources for ColdFusion.


if you cant access the coldfusion administrator and have no control panel to add a datasource you need to ask your host to add a datasource for you with a name. A datasource in this context is different from having the database created - its having the database "registered" with the coldfusion administrator so that it can be referenced via a datasource name

once the datasource is created you can hit it by adding the datasource attribute to the cfquery tag: cfquery name="myquery" datasource="mydatasourcename"


My DNS on my hosting plan is, well I think is - mysqlcf_bridgettips and on my ColdFusion is cfGossip.

The coldFusion Administrator should have a datasource that contains your mysqlcf_bridgettips information (CF datasource name, database name, server IP and port, username/password). If you've named that datasource cfGossip in the administrator than your cfquery should look like:

<cfquery name = "variableNameOfYourQuery (ex. qUsers)" datasource = "cfGossip">

I put my username/password in my datasource in the administrator so I don't have it written in my code.

I believe CF5 was the only version of CF that allowed DSN-less connections that would require a "connection string".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号