CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2002
    Location
    India
    Posts
    20

    Connect Access on remote server using ADO

    Hi All,

    I am using VB6 and access 7.What will be connection string if i want to connect access database which is not on the local pc but at remote server using IP Address of that server with out using DSN.

    Thanks in advance.

    Jignesh

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477
    ADO supports network paths, so it is possible to do something like this:
    Code:
    cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;data source=\\192.168.0.1\someshare\mydatabase.mdb;"
    Tom Cannaerts
    email: cakkie@cakkie.be.remove.this.bit
    www.tom.be (dutch site)

  3. #3
    Join Date
    Jun 2002
    Location
    India
    Posts
    20
    Thanks for your prompt reply.


    Jignesh

  4. #4
    Join Date
    Jun 2002
    Location
    India
    Posts
    20
    Hi,

    Thanks for your reply that seems to be working fine but now how to supply password for the access database and password for accessing remote server both in same connection string.
    Or if not in same connection string then is there any way to pass both the password.

    Jignesh

  5. #5
    Join Date
    Jul 2002
    Posts
    62
    I believe the authentication that would be in that connection string would be used solely to log into the database. If you need to authenticate the share, you must map the drive in a preceeding connection string.

  6. #6
    Join Date
    Apr 2011
    Location
    Rochester, NY, USA
    Posts
    1

    Question Re: Connect Access on remote server using ADO

    Hey

    thanx but I was wondering where is that "someshare"

    Suppose I have my database in c:\aj\database.mdb , then how would taht data source change?

    It would be helpful if you could let me know.

    Thank you


    Quote Originally Posted by Cakkie View Post
    ADO supports network paths, so it is possible to do something like this:
    Code:
    cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;data source=\\192.168.0.1\someshare\mydatabase.mdb;"

  7. #7
    Join Date
    May 2009
    Location
    London
    Posts
    51

    Re: Connect Access on remote server using ADO

    This needs to be done in two stages.

    Firstly you need to have permission to the network share. This can be easily done by opening the shared folder in Windows Explorer or via Network Neighbourhood. When you are asked to supply a username / password make sure that you tick the box to remember password.

    You can also map this network share to a drive letter but you must set it to reconnect at next logon.

    Your code to open the Access database woud be

    DAO
    Code:
        Set db = DAO.OpenDatabase("\\192.168.0.1\SHARENAME\Database.MDB", False, False, ";pwd=LetMeIn")

    ADO
    Code:
    cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\192.168.0.1\SHARENAME\Database.MDB;Jet OLEDB:Database Password= LetMeIn"
    In the above examples....
    192.168.0.1 is the IP address of the server
    SHARENAME is the network share name of the shared folder containing your Access database.
    Database.MDB is the Access database filename
    LetMeIn is the Access database password

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured