link to a mdf database

Posted on 2004-03-30
Medium Priority
Last Modified: 2013-12-16
ok so i created a MS SQL db , but now i cannot link to it.

 I WOULD like to create a database in my C:/Cfusion/wwroot folder and not in ProgramFiles/MicsoSQL/Data folder.

Is that possible? How? I cannot create a new database in anywhere but ProgramFiles/MicsoSQL/Data folder.

Now i have an mdf in wwroot, but it does not show in enterprise manager?

This is bothering me because i need to seelct it so i can create a super user for it , and then an ODBC datasource so i can use it with coldfusion.

I think it needs to be in my wwwroot to work for coldfusion
Question by:finnstone

Author Comment

ID: 10720945
basically my site stopped working and i dont know why, all i did was change from access to sql (first experience with sql) and i have a host.

i posed the question aboce because now i am testing on my computer, the host took care of my sql stuff so the problem has to do with the code i used

all i i did was change

all instances of cfquery datasource="#Application.DataSource#"


cfquery datasource="#Application.DataSource#" username="xxxxxx" password="xxxxx"

I also changed my application.cfm file to

<cfset Application.DataSource = "blueprintdatabase">

Accepted Solution

ctcampbell earned 2000 total points
ID: 10721070
This seems to be a continuation of your other questions (with more detail), so I'll try to answer completely.  If this answers your other questions, please make sure to follow up on them, too.

SQL Server does not behave the same way as Access.  You do not connect to the MDF file.  You connect to the server and select a database.  The default location for the database files is (I think), \Program Files\Microsoft SQL Server\MSSQL\Data, though you can point a database to a different location when you create the database (either with Query Analyzer (QA) or Enterprise Manager (EM)).  Please look at "CREATE DATABASE" in the books online.  If you are creating the database in EM, look at the "Location" box in the "Data Files" or "Transaction Log" tabs of the "Database Properties" box.  I would highly recommend that you not put the mdf and ldf files anywhere in your web document tree.  They should not be accessible from any URL.  You might want to create a folder called "Data" under "Inetpub" for the SQL data files that is not world-readable.

If you wish to move a data file, then you need to detach the database, move the data file, and reattach the db (see "sp_detach_db" in Books Online).

As for ColdFusion, it comes with native SQL Server drivers that you should use instead of ODBC.  On the datasources page, enter a name for your datasource (this can be anything, it's just a description to use in your CFQUERY's) and select Microsoft SQL Server as the type.  Then, the database name is the name of your database in SQL Server, the server is the hostname or IP address running SQL Server (i.e. localhost) and the username and password are a SQL Server user name.  Your SQL Server should be set for mixed-mode, and you should have created the user in EM with access to the database.
LVL 13

Expert Comment

ID: 10721769
I think it needs to be in my wwwroot to work for coldfusion -- No.  This does not matter, the ODBC connection takes care of the information.

This may sound like a stupid question, but:
Is your host providing a SQL-Server for your database to attach to at the other end ?
LVL 75

Expert Comment

by:Anthony Perkins
ID: 10743343
Please maintain your many old open questions:

1 03/15/2003 25 link to 1000 outstanding points  Open Macromedia Flash
2 05/13/2003 270 Who is good at reading source code?? (10...  Open Macromedia Flash
3 07/24/2003 500 PAYPAL in FLASH  Open Macromedia Flash
4 07/28/2003 500 Need to add UPS Online Tools to my ecomm...  Open ColdFusion
5 12/13/2003 500 best credit card processing service for ...  Open ColdFusion
6 12/13/2003 500 payment processing  Open Web Servers
7 11/17/2003 500 360 viewer  Open Macromedia Flash
8 03/29/2004 500 Decrease File Size  Open Macromedia Flash
9 03/29/2004 500 MDF OR LDF  Open Microsoft SQL Server
10 03/30/2004 0 Converted MS Access Datasource to SQL  Open ColdFusion
11 03/30/2004 500 link to a mdf database  Open Microsoft SQL Server
12 03/30/2004 500 sql server not working  Open ColdFusion
13 03/31/2004 500 update query between access and mysql?  Open Mysql
14 03/31/2004 500 Cannot connect to mysql on localhost err...  Open Mysql
15 04/01/2004 500 error executing db query after moving to...  Open Mysql
16 04/01/2004 500 weird error message from calling a cfc  Open ColdFusion
17 05/12/2003 35 simple SELECT statement confusion....wha...  Open ColdFusion
18 06/12/2003 125 Copy contents of one table to another us...  Open ColdFusion
19 08/29/2003 500 Custom tags in a CFC??  Open ColdFusion
20 10/28/2003 500 Coldfusion Server Not Working because i ...  Open ColdFusion
21 11/25/2003 500 root variables?  Open Macromedia Flash
22 01/06/2004 500 finding the letter of my cd drive?  Open MS-DOS

LVL 35

Expert Comment

ID: 10880175
No refund as finnstone never responded to the experts

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question