error creating new connection string (VBexpress SQl Express)

Hi

I have finished developing a serial number DB with SQLexpress and VB express, and would like to publish/deploy the application to a shared network drive so colleagues can acces the DB.

Before I publish the App.I want to move the DB (.mdf) to a shared network drive. So that when publishing th db. It will have a connection string that everyone can access.

In VB I am tring to connect to the DB moved from my local machine to the network share(server), and keep getting errors.

The error states" database1.mdf is on a network path that is not supported for database files. possible causes

db with same name exists - have tried renaming the db

specified file cannot be opened - have given everyone full access to the file

or it is located on a UNC share - it is located on a UNC share, but how do I get around that if I want to move the DB to an accessible server.

Thanks

What am I doing wrong



Answer this question

error creating new connection string (VBexpress SQl Express)

  • Sundararajan

    I'm not sure if the situation you described already has this in place but... you could try mapping the share to a local drive letter and then using the drive path in your connection string.

  • cdub772

    I'd check out some article relating to enabling SQL Express for Remote Access.

    http://www.google.com/search q=SQL+Express+%2B+remote&hl=en&lr=&start=10&sa=N

    One of these may help you and allow you to run SQL Express on the network server and allow the clients to access this server.


  • Stargazer99

    That results in the error message :

    "The connection to the database could not be created. Only connections to local database files (sql.mdf and jet.mbd) are allowed in this edition of visual studio."

     


  • Max Slade

    SQL Express doesn't allow you to connect to database files over a file share. Unlike file-based databases like Access, SQL Express runs as a service that attaches to the database and then works pretty much like any other version of SQL Server. If you want to enable multiple users , you'll need to setup the database to be accessed remotely.

    First, enable remote database connections to the machine with SQL Express. There are some good instructions here for doing that:

    http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx

    Once you have a machine setup with remote access enabled, you'll also need to attach your local database file. You'll want to attach to the main instance. The easiest way to do that is to download sseutil from http://www.microsoft.com/downloads/details.aspx FamilyID=fa87e828-173f-472e-a85c-27ed01cf6b02&DisplayLang=en and then run the following command:

    sseutil -m -a <PathToYourDatabaseFile> <DatabaseName>

    DatabaseName can be any valid name of your choosing. For example, if you were attaching a Northwind database from d:\Northwind.mdf the command would look like:

    sseutil -m -a D:\Northwind.mdf Northwind

    After you have attached the database, you will need to alter the connection string in your application to use the remote server and database instance instead of a file path. By default the database instance name for SQL Express is "SQLEXPRESS". Here's the format of a minimal connection string:

    Data Source=<ServerName>\SQLEXPRESS;Initial Catalog=<DatabaseName>;Integrated Security=True

    DatabaseName is whatever you chose when attaching the database. Extending the example above, if you have a server named "MyDatabaseServer" you would use the following connection string:

    Data Source=MyDatabaseServer\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True

    After that you should be able to connect multiple concurrent users. I hope this helps.



  • error creating new connection string (VBexpress SQl Express)