Avatar of lschwabe

asked on 

Problem Sharing A MS SQL Server 2012 Express Database with Multiple VB 2013 Users on a Private Network

I have an application written in Visual Basic 2013. The application maintains a SQL Server 2012 Express SP1 (x64) database. The computer the application is installed on (#1) and a second computer (#2) use Microsoft Windows 10 operating systems. Both computers have SQL Server 2012 Express SP1 (x64) installed and are on a local network . Computer #1 runs the application locally (from it's 'C' drive) and computer #2 runs the application through the network. Both computers can run the application successfully provided only one computer is running the application at a time. The problem occurs when either computer #1 or #2 is running the application (which wil run successfully) and the application is started on the other computer the 2nd application run  will fail because it is not able to open the database. The error message is as follows:
'Unable to open the physical file "\\Desktop-uptn518\cmsrs\data\System.dbf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
An attempt to attach an auto-named database for file \\Desktop-uptn518\cmsrs\data\System.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
The connection string used was
"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\data\System.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
Any help or suggestions would be greatly appreciated. Thanks in advance.
Microsoft SQL Server.NET ProgrammingDatabasesMicrosoft DevelopmentVisual Basic.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon