hi.

can anyone tell me the connectionstring for connecting to an ms access database over a network?

only the second part, where you specify the location of the database, is needed. i know how to specify the jet engin.

let me give an example.

to connect to a local dbs the connection string would be:
c:\\localFolder\\localDbs.mdb

but how do i specify a database on a computer on the network?
let say this computer's name is databaseServer and the database is on the c drive?

Dani AI

Generated

Short answer: point the connection string at a network share (UNC or a mapped drive) and use backslashes. As found, you must specify the machine/share where the MDB lives. ran into problems because the Data Source used the wrong slashes/format and the string literal was malformed.

A correct form (C#) looks like this:

// verbatim literal (easier to read)
var connStr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Server01\Databases\Invoices.mdb;";
using (var cn = new OleDbConnection(connStr)) { cn.Open(); /* ... */ }

Or, using an escaped regular string:

string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\\\Server01\\Databases\\Invoices.mdb;";

Key practical notes and gotchas:

  • Prefer UNC (\ServerName\Share\path\file.mdb) over mapped drives because mapped letters are per-user and services/other accounts often can't see them.
  • For Access 2007+ (.accdb) use the ACE provider (e.g. Provider=Microsoft.ACE.OLEDB.12.0) and ensure the provider is installed.
  • Jet is 32-bit only: on a 64-bit machine build your app for x86 or use the 64-bit ACE driver.
  • Verify both Share and NTFS permissions for the account running the app; being able to open the path in Explorer from the client is a quick test.
  • Access is file-based — for many concurrent writers or WAN access, move the data to a server DB (SQL Server/Express) or at least split frontend/backend and keep the backend on the LAN.

Quick checklist if a connection fails:

  • Paste the UNC into Explorer (\Server\Share\path\file.mdb) and confirm you can open it.
  • Fix string quoting (use backslashes) and try a verbatim C# string.
  • Check share + NTFS permissions and any antivirus/backup locks.
  • Ensure the correct OLEDB provider and process bitness.

This addresses the formatting issues in the thread and adds safety and deployment notes for multi-user scenarios.

this is OK. I figured it out. I suppose i should have experimented before posting.

in case anyone else cares the way is to specify the computer on the network. like so:

@"databaseserver\c\remotefolder\remotedatabase.mdb"

Good morning,

Please, can you give me the code to connect to the access database on a shared folder. This code didn't work for me:

OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=@//ServerName//SharedDocs//CS//db1.mdb");

What do I need to do?

Thanks in advance,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.