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
Printable View
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
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;"
Thanks for your prompt reply.
Jignesh
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
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.
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
In the above examples....Code:cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\192.168.0.1\SHARENAME\Database.MDB;Jet OLEDB:Database Password= LetMeIn"
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