Skip to main content
Participant
September 13, 2010
Question

How to find the file name for a database

  • September 13, 2010
  • 2 replies
  • 931 views

I'm still learning coldfusion and I'm currently working on a form that is connected to a database. According to the code datasource="McSoz", I know the database file is Mcsoz but I can't find a database file with that name (Access, SQL, anything) on our server. How can I use this information to find the database file associated with the form. I'm being asked to transfer the form to another server and will have to transfer the database too.

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
September 29, 2010

<!--- Login into Coldfusion Administrator. Use your own password. --->

<cfset  createObject("component","cfide.adminapi.administrator").login("BKBK_Password")>

<!--- Instantiate the data source object. --->

<cfset  dsObj = createObject("component","cfide.adminapi.datasource")>

<!--- Get a structure containing data sources for a specified data source name.  --->

<cfset datasources = structNew()>

<cfset datasources = dsObj.getDatasources("McSoz")>

<!--- Get path of database file --->


<cfset dbFile = datasources.databaseFile>

<cfoutput>#dbFile#</cfoutput>
Inspiring
September 13, 2010

Log into the ColdFusion administrator and look for a data source named McSoz.  Examine the data source to see what file/server it is configured to use.

tclaremont
Inspiring
September 29, 2010

As you have found out, the datasource name is not necessarilly the database name. You could

have a database named "Foobar" and a datasource pointing to that database named "YingYang".

As has been suggested, the easiest way to do this is to go to the ColdFusion administrator page and look at the data sources section to find out what is what. If you are using a hosting provider that prevents access to the ColdFusion administrator then a support call might be in order to the hosting provider.