Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Link to an MDF database

  1. May 24, 2017 #1
    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 select 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
     
  2. jcsd
  3. May 25, 2017 #2
    Guys, can help me? I would be grateful for any advice.
     
  4. May 25, 2017 #3

    QuantumQuest

    User Avatar
    Gold Member

    When you create a web application you must have a web server and a database server. You put your web pages - or parts of the web application that are used / served by the web server in general, in the root folder of your web server (following some tree structure) and you create connections to the database server, in order to request content. Now, in order to work with ColdFusion and IIS (and any other web server for that matter), ColdFusion server takes the SQL content of the cfquery tag and passes it to the specified driver of the data source. So, you have to configure data source first. For how to do this take a look here. The data files for the database server are kept in the database server.

    Also, if you want to take a look at some basics of ColdFusion - in case you don't know ColdFusion (although not very popular any more) here is an interesting link.
     
  5. May 25, 2017 #4
    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.
     
  6. May 25, 2017 #5
    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). If the file is corrupted or doesn't open you, then you need mdf opener.

    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.
     
  7. May 25, 2017 #6
    Thank you all for your advice! I'm appreciative for your responses and help.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Link to an MDF database
  1. Distributed database (Replies: 6)

  2. Infinite Databases? (Replies: 10)

Loading...