multiple connections to an mdf file

前提是你 提交于 2019-12-08 01:06:23

问题


im creating a .Net application using c# for a university project and need some help!

I have a mdf file hosted on a network drive and need several clients to be able to access this database from their applications. Each client machine will be running their own instance of sql express.

I can access file from my application, but when another client tries to they receive the following error message

Cannot open user default database. Login failed. Login failed for user 'EEEC\40023753'.

The database state is configured to allow multiple users

The Connection String I am currently using is :

"Data Source=.\SQLEXPRESS;AttachDbFilename=\\servxxx.eeecs.qub.ac.uk\Virtual_Directories\level3\cs8\App_Data\cs4_database.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

Any comments would be greatly appreciated!


回答1:


You need to host the database server on the network server. Several client can connect to the SQL Server Service. But several clients cannot simultaneously connect directly to the mdf file.

The file alone cannot handle concurrency. You can have multiple connection to a database server. The database software is what handles the concurrency.



来源:https://stackoverflow.com/questions/19843631/multiple-connections-to-an-mdf-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!