Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 mdf file on a file server

Author  Topic 

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-10 : 11:28:58
I have written my application in vb.net with the data file being a sql server .mdf file currently stored on my hard drive using an instance of sql express.

However the intention is to have the file on a file server so that the client will be on users computers and the database on the server.

I just tested my app with the .mdf file on a file server and got this error:

The file "\\maze\pcc$\Developer\TestDB\TestSQL.mdf" is on a network path that is not supported for database files.
An attempt to attach an auto-named database for file "\\maze\pcc$\Developer\TestDB\TestSQL.mdf" failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Oh please PLEASE tell me I can access an mdf file on the network!!

I am in BIG s**t if it it is not possible.

If not can anyone please suggest a way to save my bacon?

For the record a SQL Server instance on this or any other server is out of the question!

I thought that as VS.NET provided all the divers etc it would work.

I am in meltdown panic mode!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-01-10 : 11:47:47
SQL Server MDF files are accessed only through an instance of SQL Server; applications do not directly access the database files.

You should read about the architecture of SQL Server in Books Online before attempting to implement an application.





CODO ERGO SUM
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-10 : 11:53:18
? I know that. The sql files supplied by my application takes care of the acces.

I just need to know if an mdf file can be accessed across a network or not?
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-01-10 : 12:22:54
The error message that you got seems self-explanatory:
"The file "\\maze\pcc$\Developer\TestDB\TestSQL.mdf" is on a network path that is not supported for database files."






CODO ERGO SUM
Go to Top of Page

mharr
Starting Member

20 Posts

Posted - 2008-01-10 : 12:56:50
quote:
Originally posted by hog
[brI just need to know if an mdf file can be accessed across a network or not?



No, mdf files cannot be on network drives. Network access is too slow and inconsistent to work with keeping multiuser databases in consistent state. The only exception is if the network drive is setup and configured using iSCSI interface, where file operations are able to be monitored and corrected.

However, you can have database files on a network file share if you use SQL Server 2005 Compact Edition. There are some other limitations, but you can store the data files on a network file share.

Hope this helps

Mark
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-10 : 13:03:33
mharr, thanks for a very concise answer, it is appreciated. I have not heard of the compact version, different I guess from Express?

Oh by the way Michael Valentine Jones, If you have nothing to say in a meaningful helpful way, dont bother saying anything, unless of course you do so to increase your post count?







Go to Top of Page

mharr
Starting Member

20 Posts

Posted - 2008-01-10 : 13:45:47
Yes, Compact Edition is different that Express Edition (see http://www.microsoft.com/sql/editions/compact/sscecomparison.mspx).

Compact Edition was developed originally for use on Windows CE devices (PDAs, smartphones, cable boxes, etc), but can also be run on Windows XP and Vista. It is more like a file-share database like Jet, rather than a full RDBMS like SQL Server. You can learn more about it here: http://www.microsoft.com/sql/editions/compact/default.mspx


Mark
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-10 : 13:52:27
I see that the compact is for single user though? I need at least 5 maybe more users.

I have read elsewhere about using express on a pc?

I have a pc in my office on 24/7 running windows xp pro. Could I install express on that and have the database there?

Although in saying that our corp setup is to have server service turned off, so users would not be able to see it??
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-10 : 23:36:36
Yes, sql2k5 express runs on win xp. If sql service is off, no one can access that sql instance.
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-11 : 03:24:27
I will try to set this up and see what happens and post back..... thanks for the advice
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-11 : 08:33:44
I would really appreciate some help with this please as my ... manhood relies ont it!!!

I have setup sql express 2005 on a Windows XP PC called FUSION.
I have installed the SSMSEE on the same PC
The instance is called FUSION\SQLEXPRESS
In the security I have added my windows network logon
In the databases I have created a database named TestNetworkDB

I open VS.NET Pro and add a Microsoft SQL Server datasource
I click on the Server names but FUSION is not there
On the server PC I have enabled named pipes, tcp/ip and via
FUSION still does not appear
The default is server service not running but even if i turn on it does not work
The sql express instance is running

help???
Go to Top of Page

mharr
Starting Member

20 Posts

Posted - 2008-01-11 : 08:44:02
Did you check the firewall on FUSION that it allows SQL Server access? See the following articles:

MSKB 841251: How to enable SQL Server connectivity on Windows XP Service Pack 2
http://support.microsoft.com/kb/841251/en-us

MSKB 939980: How to use a script to programmatically open ports for SQL Server
http://support.microsoft.com/kb/839980/en-us

Mark
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-11 : 10:45:32
Excellent, some progress made :)

I did the excpetions bit in the firewall and now fusion appears in the server list but the instance name does not appear after it, fusion\sqlexpress.

In the database selection there are no entries.

In server explore I can connect to fusion as a server and see various entries but not as a data connection?

Go to Top of Page

mharr
Starting Member

20 Posts

Posted - 2008-01-11 : 11:32:43
You may have to just manually "force" the data connection, by typing in the server/instance and database name. The SQL browser service may not be getting through firewall. Or SQL Express may not have the SQL Browser Service (I'm not real familiar with setting up SQLExpress).

Try this: from desktop of a client PC (not Fusion), right-click and create a new text document. Rename the text document to "mydb.udl". Open that file, and it will open Data Link Properties window. Select SQL Server driver, type in "Fusion\SQLExpress" for server and your database name (and of course your authentication), then click "test connection". That is quick way to tell if you have database access or not.


Mark
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-11 : 12:38:39
I am at home now so cannot do anything physically with fusion until Monday.

However I do recall seeing an entry for browser service and if my memory serves me well it was not enabled, but ignored as I did not know what the browser was for?

Using VPN here at home I have just tried your suggestion and I get the error sql server does not exist or access denied.

I then tried the same on another full blown SQL Server host and the connection worked.

So it does look like I need to find out what config setting is not right on fusion.

Although saying that the one that worked was full SQL S whereas fusion is express so not an exact comparion.

Doh!
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-12 : 00:35:39
Ensure you enabled remote connection and started sql server browser service, also check port number since named instance uses dynamic port by default.
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-14 : 03:35:09
Hi,

OK

I have opened sql server configuration manager and do not see a remote connection setting?

I have started the browser service

I don't know about opening ports or how to determine which one to open?

I do know that I would prefer to limit the IP range to the site where the application will be used so I presume in the firewall settings I would need to change the scope to My Network? This would then restrict only usere locally in our building to connect and no one elsewhere on our intranet?

I still do not see any database listing to connect to?

In services there is an entry for SQL Server Active Directory Helper which is disabled, should this be running too?

Thanks

Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-16 : 04:31:22
At last I am there :)

This link is what helped me resolve my problems once and for all :)

[url]http://www.datamasker.com/SSE2005_NetworkCfg.htm[/url]
Go to Top of Page

mharr
Starting Member

20 Posts

Posted - 2008-01-16 : 08:13:08
quote:
Originally posted by hog

At last I am there :)

This link is what helped me resolve my problems once and for all :)

[url]http://www.datamasker.com/SSE2005_NetworkCfg.htm[/url]



Good to hear. And thanks for being a good forum citizen, by posting the link for the page that helped you, so that others who run across this will find the help they need.

Mark
Go to Top of Page

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2008-01-16 : 10:44:08
It has been a wonderful learning Journey and I am happy I am now sorted, and thanks for your help adn advice too :)
Go to Top of Page

pcd
Starting Member

1 Post

Posted - 2008-10-28 : 06:21:01
quote:
Originally posted by Michael Valentine Jones

The error message that you got seems self-explanatory:
"The file "\\maze\pcc$\Developer\TestDB\TestSQL.mdf" is on a network path that is not supported for database files."
CODO ERGO SUM



DBCC TRACEON ( 1807 )

then create the database and enjoy network databases.

NB Don't believe everything you see / read, research and test everything yourself - including this info

pcd
Go to Top of Page
    Next Page

- Advertisement -