Solved

Trouble Attaching MDF file From Client

Posted on 2002-06-05
9
612 Views
Last Modified: 2008-02-26
I have a utility written in Delphi which uses Sql Dmo to talk to Sql Server. I have a local installation of Sql Server and there is also a Server installation.

The utility prompts the user for a Database Name and file location (for the mdf). If the location doesn't exist it creates it. Then it copies an empty version of our application's MDF file to the location and attempts to attach it to Sql Server using the following syntax:

dmo.AttachDBWithSingleFile(edtSqlDBName.Text, sFileLocNew);

edtSqlDBName.Text does contain the Name of the database and sFileLocNew does contain a full path to the mdf file.

When running against my local copy of Sql Server everything works just fine. The file is copied and then attached using the new name.

But when trying the same thing against the server I am able to create the new folder and copy the mdf file, but I get the following error when attempting to attach:

File '\\Labserver\C\Program Files\Kewill\JobBOSS\Databases\TrainSql\TrainSql_data.mdf' is on a network device not supported for database files.

What has gone wrong? I know I can talk to the server version as I have done other things (including detaching, copying and then reattaching databases) with it.

Thanks
0
Comment
Question by:bjames
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 7

Accepted Solution

by:
lozzamoore earned 200 total points
ID: 7056380
Make sure you are referencing the sFileLocNew parameter as a local path relative to the SQL server you are running the command from.

SQL server will only let you attach a database that is local to it, and the command is obviously checking for a UNC path, even if the UNC path corresponds to a local path.

Hope that makes sense and helps.

Cheers
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7056385
The problem is that you try to attach a file that is actually local, but the path is like it were remote.

You must change the path that you supply from
\Labserver\C\Program Files\Kewill\JobBOSS\Databases\TrainSql\TrainSql_data.mdf
to this:
C:\Program Files\Kewill\JobBOSS\Databases\TrainSql\TrainSql_data.mdf

CHeers
0
 

Author Comment

by:bjames
ID: 7056396
I'm in a bit of a bind now. You both answered at virtually the same time with virtually the same answer which IS the solution. I'm not sure what the protocol is here.

According to the timestamps Iozzamoore is about two minutes earlier than angellll. Going on a 'first come first served' basis that means Iozzamoore should get the points. But since both have given me the solution does this fit with Experts Exchange protocol? I want to do the right thing.

Thanks
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7056554
You can of course accept the first one, or if you prefer, ask the Community support (using a 0-point question there) to split the points. DOn't forget then to post a link to your question so they know which q you want the split.
CHeers
0
 
LVL 7

Expert Comment

by:lozzamoore
ID: 7056608
The points should obviously go to me! ;-)
Seriously though, I am happy to split.
Cheers,
0
 

Author Comment

by:bjames
ID: 7056630
I posted to the community and nfroio said that this has happened to him/her and that generally points are awarded based on the earliest correct answer by timestamp. So that is how I will resolve my conflict.

Thanks to both angellll and Iozzamoore for the help.

Thanks
0
 

Author Comment

by:bjames
ID: 7056632
I suspected this was probably the case, but I couldn't find anything in the help files about it.

Thanks
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7056803
Glad we could help.
CHeers
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7056868
Perfect solution here.  Since both experts were concurrently typing (one slower than the other ;), I have also posted a separate question for angellII here (not at your expense, but from my points).  It seems most fair.
Points for angelIII -> http://www.experts-exchange.com/jsp/qShow.jsp?qid=20308197

:) Moondancer - EE Moderator
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

739 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