[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
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).
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.
Re: [2.0] Connecting to Access Database
In VB I do it this way:
vb Code:
Public Sub BuildConnString()
If mdlGeneral.gstrFullDBInfo.Trim() <> String.Empty Then
If mdlGeneral.gstrConnString.Trim() = String.Empty Then
mdlGeneral.gstrConnString = String.Empty
mdlGeneral.gstrConnString = "Provider=Microsoft.Jet.OleDb.4.0;"
mdlGeneral.gstrConnString &= "Data Source=" & mdlGeneral.gstrFullDBInfo.Trim()
End If
End If
End Sub
mdlGeneral.gstrFullDBInfo.Trim() is a string that holds the database location for you 100.100.110.121\C:\folder here\dbname
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.
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.
Re: [2.0] Connecting to Access Database
Thank you very much. I understand better now.
Jennifer.