none
Connecting to a Microsoft JET 4.0 database (.mdb) over a LAN network RRS feed

  • Question

  • Hey,

    I'm building a .NET application in C# and I need to run it on a LAN network on Windows XP or newer. So far, I've made an algorithm to make and manage databases (Microsoft JET 4.0 databases .mdb) and I can normally use them while on a single PC using this connection string:

    string conn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "DataProvider=D:\Database.mdb;" + "Persist Security Info=False";

    But I need to access a database from my application that's for example in a shared folder on another PC over LAN network. And I know that if I try to open a shared folder on Win7 "Computer\Network\DistantPC\SharedFolder" it pops up a window that says "Username" and "Password". So it has password protection which I need to resolve too.

    Probably all I need is a good, unique connection string that can access a database like "\\192.168.1.5\SharedFolder\Data.mdb" without throwing an exception about permission. I can access it like this, but only when I disable passworded sharing on that host PC.

    Please help... Thanks !

    Wednesday, November 6, 2013 6:09 PM

Answers

All replies

  • Take a look at NET USE. But basically this should not be necessary. As your application runs in a friendly environment, thus the clients should be already connected.
    Wednesday, November 6, 2013 6:39 PM
  • Thank you for your quick response.

    I only know that "net use" is a command in cmd.exe prompt, but I have never used it. Please explain more. Can you provide me with some good connection strings that can somehow connect to a database as a trusted connection? I mean without throwing exceptions like "password protected" or "insufficient permissions".

    Wednesday, November 6, 2013 8:30 PM
  • How large is the db and how is your network latency? Generally speaking you should not use an access database over a network - a connection disruption could corrupt the data, especially when your data grows. I had 2 database corruptions before giving up the idea.


    Visual C++ MVP

    Wednesday, November 6, 2013 11:14 PM
  • Please tell me then which database should I use? And with that, please give me the connection string for my situation as explained at my post and the extension of the file for that other database. 
    Thursday, November 7, 2013 4:50 PM
  • I switched to SQL Server. You can try the express edition.


    Visual C++ MVP

    Thursday, November 7, 2013 4:57 PM
  • Hi ,

    Thanks for your posting.

    From your description,  this issue is related to connect to a Microsoft JET 4.0 database (.mdb) over a LAN network.Based on my experience , I think that  Data Platform  Development  forum is more suitable for it. So I move it to that  Data Platform  Development forum.

    Hope these help.


    Lilia Gong <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 11, 2013 5:44 AM
  • Thank you all for helping, I found the solution in MS SQL Server Express.
    • Marked as answer by Emil Kosic Monday, November 11, 2013 1:37 PM
    Monday, November 11, 2013 1:37 PM