Results 1 to 7 of 7

Thread: [2.0] Connecting to Access Database

  1. #1

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    [2.0] Connecting to Access Database

    Hi. I'm trying to connect to an Access Database and I was successful in doing so on localhost. I used an OleDBConnection and OleDBCommand to do a simple connection. Everything is working fine.

    However, I want to modify this to connect to a database on another server lets say with ip 100.100.110.121. So i copied the database on that server but not finding a way to connect other than a database on localhost.

    I never had to use Access this way but I did something a while ago with oracle which has a client and server, and you install the client on a machine, connect to the server, and the program connects to the client. I really have no idea if Access is like this, or if I could directly connect to it on another server.

    Any suggestions?

    Jennifer

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: [2.0] Connecting to Access Database

    If the other machine (server) is in your domain then yes you can connect using the OLEDBConnection object and supply the path to the DB on that machine (the folder must be shared and everyone tring to connect needs read,write and delete permissions on the folder).
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: [2.0] Connecting to Access Database

    The Connection string to oledb is as follows:

    oledbconnection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "\"" + @"C:\Hyper.mdb" + "\"";

    This is what I have presently on my machine. I installed it on machine: 100.100.110.121 in the same drive: C.

    100.100.110.121 is on my domain, but I'm not seeing anywhere where I could connect to this ip address. Is there anything with access like oracle where an access client could connect to an oracle client?

    Jennifer.

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: [2.0] Connecting to Access Database

    In VB I do it this way:

    vb Code:
    1. Public Sub BuildConnString()
    2.         If mdlGeneral.gstrFullDBInfo.Trim() <> String.Empty Then
    3.             If mdlGeneral.gstrConnString.Trim() = String.Empty Then
    4.                 mdlGeneral.gstrConnString = String.Empty
    5.                 mdlGeneral.gstrConnString = "Provider=Microsoft.Jet.OleDb.4.0;"
    6.                 mdlGeneral.gstrConnString &= "Data Source=" & mdlGeneral.gstrFullDBInfo.Trim()
    7.             End If
    8.         End If
    9.     End Sub

    mdlGeneral.gstrFullDBInfo.Trim() is a string that holds the database location for you 100.100.110.121\C:\folder here\dbname
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: [2.0] Connecting to Access Database

    Ok I made some progress. I created a folder in the C drive and set the sharing permission to allow. inserted my databsae there and changed the connection string as:

    MyConnect.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "\"" + @"\\100.100.110.121\Shared\Hyper.mdb" + "\"";


    This worked fine. Is this how Access works? Is the folder that the Database in needs to be shared to everyone?

    Thanks for you help.

    Jennifer.

  6. #6
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: [2.0] Connecting to Access Database

    The Access creates a databasename.ldb file when accessed and deletes the file when the last person exits the database. So each person needs read,write and delete permissions on the folder.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  7. #7

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: [2.0] Connecting to Access Database

    Thank you very much. I understand better now.

    Jennifer.

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