How to connect database in server from a client computer?


  • I know this may sound dumb, I really have no clue on this. I wrote a program in VB2005. It is a program that is supposed to run in a client computer accessing an MS Access .mdb file stored in the server. The program itself is stored and run in the clients computer. I am not good in networking at all. The way I do it now is:
    1. Have a directory made in the server to hold the MS Access .mdb file, and have the directory to be shared.
    2. Have the same directory accessed and mapped in the client computer (say to Z:\)
    3. Then have the program in the client computer simply access the database as if it is in the same computer (as the directory already mapped into the client computer). In the VB 2005, this is done when we set the connection string of the database connection.
    However, my user is complaining that by doing so, the database is basically exposed to the operator of the client computer (through the mapped directory), hence more vunerable for any bad intentions from persons who may have access to the client computer but not the server. He insists that he used to have a program that does exactly the same thing like my program, but the database is shielded in the server, where it cannot be seen in the client computer (I have other people who confirm that this can be done, though they can't tell me how, since they are not programmers themselves). Now, I have no idea on how to connect a database that way, and I don't even know where to start looking. Can anyone help me, please?
    Thank you so much.
    Sunday, February 24, 2008 11:59 AM

All replies

  • Hi,


    this isn't a VB question.

    But two points to mention:

    1. give access rights to mdb-file

    What to do depends on the configuration. Are you using XP or Vista on the client side? Do some server act act as Sign-On-Server or do you use a workgroup?

    The easiest way maybe to assign a password for the share at the server.

    2. using Sql Server

    If you really want to share a database, I recommend using the Sql Server which is designed for multiple concurrent access to databases.

    MS-Access fits more in a single user enviroment. If this is true in your situation then why does the mdb file reside on the server?




    Sunday, February 24, 2008 12:16 PM
  • Presumably Phillip is correct that the key issue is changing access rights to the mdb file so that only someone with the correct password can access it (I'm not sure how to do this).

    And then you woulds specify a UNC path in your connection string:


    Sunday, February 24, 2008 8:08 PM
  • Thank you for the kind response. These are the extra info needed: Yes, it possibly better that I should go to sqlserver in the end, however, at the moment, I do not know much of sqlserver, but quite proficient with Access, that is why I stick to it for now, as this is urgently needed now. Yes, it is for multiple users, but it will not be more than 5 users at any given time. Both the server and the client runs on XP only. I am not sure how the mode of the server run, as I don't even know the difference between sign-on-server or workgroup (I'll try to find out, I am not the admistrator). The .mdb file already has password that people without it are not supposed to be able to access it, however, the user is fussy enough that he is concerned that some people who have access to the client computer can use password-cracking software to open it (I know, but he is the boss).


    Jal2, I assume the UNC path is only can be used if the directory is shared, right? In that way, it will create the same risk, isn't it? I mean, the mean person can simply open the network neighbourhood and find it, right? By the way, thanks for this bit of info, as it is now to me, and I will try it.


    Well, this may be marginal VB question, but I still think it is a VB question, since I need to know how to access a secure database in the server through a VB program. My understanding is that, there is a way to access a not-shared database in the server, using a VB program, and I do not know how. I would love to know how. If you can point me to a better forum to find out, I will be really appreciate it.

    Monday, February 25, 2008 12:17 AM
  • Hi,


    I know this kind of discussions, but there is NO 100 percent security available. Even if you use paper instead of computers to keep informations. Maybe somebody have the picks to unlock your door and get access to your paper.

    I think the best way is to show the people that the more security they want the more it will cost.


    Nevertheless there are several levels of security.

    1. password on network share

    If you define the network share on the server you can secure the access to this share by a password. If this share is attached to your pc then you can use this share without reentering the password. I'm not sure but I guess if somebody is loging in to this pc with a different userid he will have access too.

    2. setting access right for the mdb file on the share

    Under XP or Vista you can set access rights for every directory or file on your pc. Now only the user or user group who have the rights can read or read/update the file. This can be done on the server if you right click the file, slect properties and go to the security tab.

    By the way, doing this makes only sense if your users are defined a users and not as administrators.


    If you give rights to share or a file it makes no differance if you access the file by a assigned drive letter or by using the UNC name.




    Monday, February 25, 2008 8:58 AM
  • Hmmm,

    Those are good points. However, the administrator just showed me today another program that he is using (written by a programmer who has quit, though), where the database (an sqlserver) file is saved in a NOT SHARED directory (hence can't be seen by the client computer), yet it is accessed by a program that is in the client computer. That is what he wants. How can I do that? Can you help me please? Thank you so much.


    Failing that, if I follow your advice and set the shared directory with a password, I would assume my connectionstring must change, correct? Cany you tell me how the connectionstring in VB program should then look like?

    Tuesday, February 26, 2008 8:40 AM