what if the database is on a remote server
Main Topics
Browse All TopicsHow would I create an ODBC connection to an Access database using coldfusion?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
rudodoo,
This is the third time you've asked the same question.
Your original question is here : http://www.experts-exchang
When I get a chance I will work out exactly what you need to do and post the answer there, unless someone else has the opportunity before me.
I took out the <cfdump var="#error#"> and just put
<cf dump var="error" because it wasn't working correctly the other way. However now it says that I have a
Element RECORDCOUNT is undefined in TESTSEARCH.
Could you take a look at my code and see if there are some modifications that need to be made
<!--- Get mls list from database --->
<cfif isDefined("FORM.submit")>
<cftry>
<cfquery name="testsearch" datasource="#Request.DSN#"
SELECT mls.mlsid, mls.city, mls.state, mls.zip, mls.area, mls.price, mls.listing,
(SELECT TOP 1 mlspicpath FROM TblPicPaths WHERE mlsid = mls.mlsid) AS mlspicpath
FROM MLS
Where 0=0
<!---Search by mlsid or text fields--->
<cfif Form.mlsid IS NOT "">
AND mls.mlsid LIKE '%#FORM.mlsid#%'
</cfif>
<!---Search by CITY or list fields--->
<cfif Form.city is not "">
and mls.city = '#Form.city#'
</cfif>
<!--- search by state --->
<cfif Form.state is not "">
and mls.state = '#Form.state#'
</cfif>
<!--- Select zip --->
<cfif Form.zip is not "">
and mls.zip like '%#form.zip#%'
</cfif>
<!--- select area --->
<cfif Form.area is not "">
and mls.area ='#form.area#'
</cfif>
<!--- select price--->
<!--- select min price--->
<cfif Form.min_price is not "">
and mls.price >=#form.min_price#
</cfif>
<!--- select max price--->
<cfif Form.max_price is not "">
and mls.price <=#form.max_price#
</cfif>
<!---select listing--->
<cfif form.listing is not "">
and mls.listing ='#form.listing#'
</cfif>
</cfquery>
<cfcatch>
<cfdump var="#Error#">
</cfcatch>
</cftry>
</cfif>
"How would I create an ODBC connection to an Access database using coldfusion?
what if the database is on a remote server"
You won't likely be able to do this your self unless your host provides a control panel of some sort.. Most hosts require you submit a request to create a datasource as you won't be allowed access to CFAdmin.
Email tech support and ask them to set up the DSN for you.
I have a control panel where I can select an option called directory management.
Here I can create a custom directory where I can select between 6 different types of user permissions
1. Read Permission: This enables anonymous users to view the contents of a directory.
2. Web Permission: This enables anonymous users to view files in a directory through a Web browser using HTTP.
3. Browse Permission: This enables anonymous users to view all files in the directory (in directory listing format) by pointing their Web browser to the directory path. You must enable “Read” and “Web” permissions for "Browse" permission to work properly.
4. Write Permissions: This enables anonymous users to modify the contents of a directory.
5. Set Root: This enables you to set the directory/subdirectory folder as an application root in the Web server within your site. An application root is the root directory for an application. All directories and files contained within the application root are considered part of the application.
6. Reset: Click this to reset the permissions for this directory to their default values.
I also have to type the directory name that I want to customize
which is what I am confused about.
Should I type in the directory where I have to store my access database
or
the root folder where my web-pages are stored
Then if you have set up your dsn correctly in application.cfm then there should be no problem
Looking at this from a different view...This tells me you've a problem with your query not with your dsn
Element RECORDCOUNT is undefined in TESTSEARCH.
try this first...
<cfquery name="testsearch" datasource="#Request.DSN#"
SELECT * from mls
</cfquery>
<cfoutput>
#Testsearch.recordcount#
</cfoutput>
if that works we can move on to find out what's up with the query
rudodoo
It looks like you do Not have your database / datasource setup correctly.
This is an access db - is that correct?
Verify where it is at (the folder location on your host)
Go into your "admin section" on your host where you setup your datasources.
Try deleting the existing datasource (not database) and recreate it again.
When you are selecting database for your datasource - browse to it instead of typing it in (if you can) - this will eliminate misspellings.
You realize the slightest of misspellings will be the same as if you had an entirely different datasource name.
Also, double check the value you have on your site for Request.DSN - make sure it is not misspelled.
Also, do the query without the username & password in your cfquery tag:
<cfquery name="testsearch" datasource="#Request.DSN#"
If this has been covered in previous posts - I apologize.
Yes it is a access db file
I can't browse to the datasource like you suggested but I have double checked to make sure of its locations and they are correct
I also create just one line in the application.cfm page <cfset request.dsn="MyDataSource"
I also created a .mdw file that I uploaded into the same folder as the access database
I recreated the datasource and have double checked the values and still it is unable to define a recordcount in testsearch
What about the cf dump="variables"
Could I delete that from my above code? I also deleted the username and password. However I created one in the access database
an mdw file is irellevant in a CF setting...it's ONLY used by access when using access as a front end....
" I also create just one line in the application.cfm page <cfset request.dsn="MyDataSource"
if you actually used "MyDataSource" as the name it will fail...you need to set the dsn to the dsn that was set up by your host
cfdump has no effect on anything... it simply outputs then variables referenced///it is a debugging tool and nothing more...you can delete all references and it will make no difference to your code.
a .mdw file is the workgroup information file that I was told was missing from the remote server. Which previously stopped me from connecting to the access database or so I was informed
No I didn't get an error!!!! How can I configure that solution with the original script that I created?
Just to refresh your memory
<!--- Get mls list from database --->
<cfif isDefined("FORM.submit")>
<cftry>
<cfquery name="testsearch" datasource="#Request.DSN#"
SELECT mls.mlsid, mls.city, mls.state, mls.zip, mls.area, mls.price, mls.listing,
(SELECT TOP 1 mlspicpath FROM TblPicPaths WHERE mlsid = mls.mlsid) AS mlspicpath
FROM MLS
Where 0=0
<!---Search by mlsid or text fields--->
<cfif Form.mlsid IS NOT "">
AND mls.mlsid LIKE '%#FORM.mlsid#%'
</cfif>
<!---Search by CITY or list fields--->
<cfif Form.city is not "">
and mls.city = '#Form.city#'
</cfif>
<!--- search by state --->
<cfif Form.state is not "">
and mls.state = '#Form.state#'
</cfif>
<!--- Select zip --->
<cfif Form.zip is not "">
and mls.zip like '%#form.zip#%'
</cfif>
<!--- select area --->
<cfif Form.area is not "">
and mls.area ='#form.area#'
</cfif>
<!--- select price--->
<!--- select min price--->
<cfif Form.min_price is not "">
and mls.price >=#form.min_price#
</cfif>
<!--- select max price--->
<cfif Form.max_price is not "">
and mls.price <=#form.max_price#
</cfif>
<!---select listing--->
<cfif form.listing is not "">
and mls.listing ='#form.listing#'
</cfif>
</cfquery>
"No I didn't get an error!!!! How can I configure that solution with the original script that I created?"
Are you saying it's working now?
Or what do you mean by No I didn't get an error?
If you're still getting errors - it's pointless to configure original script.
If not getting errors then try the query you have. It looks ok on the surface ???
ok - so now Use Exactly this:
<cfquery name="testsearch" datasource="#Request.DSN#"
SELECT mls.mlsid, mls.city, mls.state, mls.zip, mls.area, mls.price, mls.listing,
(SELECT TOP 1 mlspicpath FROM TblPicPaths WHERE mlsid = mls.mlsid) AS mlspicpath
FROM MLS
Where 0=0
</cfquery>
Hello Again
<cfabort>
Will it show "Hello Again" without an error?
Business Accounts
Answer for Membership
by: pinaldavePosted on 2006-03-26 at 22:22:15ID: 16297945
Setting up the database
The first step in your application is to set up the database. This example uses a Microsoft Access database, but any database will work with the schema you create here. There are actually two steps involved:
1 Create the database.
2 Set up the data source.
Read more : http://www.macromedia.com/
--------------------------
Another good tutorial:
http://www.peachpit.com/ar