connection string to connect access database from VB

  • Thread starter vigneshwaran G via DotNetMonster.com
  • Start date
V

vigneshwaran G via DotNetMonster.com

Hi ,
I am trying ot connect a VB application to Access database.
iam using the following connection string :

con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:\
windows\desktop\ex1.mdb;Persist Security Info=False"

it worked where the access file is in the local system

but i want to access the datbase from anotehr system, a server.

Please help in forming the connection string so taht i can connect to the
remote system connected in network.

Vignesh
 
C

Cor Ligthert

Vignesharaw,

Than just change the filepath in that, all users needs to have rights for
that by the way

Access is not a database server, it is a database file.

I hope this helps?

Cor
 
V

vigneshwaran G via DotNetMonster.com

Hi Cor,
Thanks for that.
But it needs the folder containing the file to be shared!
Is there any otehr way to achieve this without sharing the file?

Thanks,
Vignesh
 
P

Paul Clement

¤ Hi ,
¤ I am trying ot connect a VB application to Access database.
¤ iam using the following connection string :
¤
¤ con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:\
¤ windows\desktop\ex1.mdb;Persist Security Info=False"
¤
¤ it worked where the access file is in the local system
¤
¤ but i want to access the datbase from anotehr system, a server.
¤
¤ Please help in forming the connection string so taht i can connect to the
¤ remote system connected in network.

Have you tried using a UNC path name?

\\servername\Database\db1.mdb


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
V

vigneshwaran G via DotNetMonster.com

Hi Paul,

Thanks for your comment.
I am not aware of the term UNC path ...

\\servername\Database\db1.mdb

As you mentioned, Please let me know how could i find the database name in
Access in the above path..and in which tag should i include this path in
connection string.

Thanks,
Vignesh
 
P

Paul Clement

¤ Hi Paul,
¤
¤ Thanks for your comment.
¤ I am not aware of the term UNC path ...
¤
¤ \\servername\Database\db1.mdb
¤
¤ As you mentioned, Please let me know how could i find the database name in
¤ Access in the above path..and in which tag should i include this path in
¤ connection string.

You need to create a "file share" on the other machine to the path where the database is located.
For the following example the share name is Database:

con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;data
source=\\machinename\Database\ex1.mdb;Persist Security Info=False"

Of course, everyone who needs to access this database must have full permissions for the folder
(file share) where the database is located.


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top