|
-
Sep 17th, 2007, 06:31 PM
#1
Thread Starter
Addicted Member
[RESOLVED] UNC path
Hi gurus
I am working on VB6 and an access database, I am using the following UNC to connect to my database but for some reason it does not work, comes back with a "path is not correct" error.
here is my connection string
"connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\servername\folder\databasename.mdb"
Thanks a bunch for any help I can get .
-
Sep 17th, 2007, 06:51 PM
#2
Fanatic Member
Re: UNC path
I'm not sure how to use databases sorry I cant be of help.
-
Sep 17th, 2007, 07:03 PM
#3
Re: UNC path
 Originally Posted by GDOG34
I'm not sure how to use databases sorry I cant be of help.
If you don't know the answer, don't answer.
"connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\servername\folder\databasename.mdb"
Maybe ; missing at the end? or maybe because you are using relative path, did you try with fixed path? like "C:\Dir\MyDb.mdb"
Last edited by jcis; Sep 17th, 2007 at 07:08 PM.
-
Sep 17th, 2007, 07:20 PM
#4
Re: UNC path
Are you actually using \\servername\folder\????
That will never work unless you have a server named "servername" and a shared folder on that server named "folder" and the database is in that folder. Use the actual names for the devices.
-
Sep 17th, 2007, 08:00 PM
#5
Thread Starter
Addicted Member
Re: UNC path
Thanks gurus.
R.
I am actually using the correct servername and the correct folder on the server which is on the c drive.
I have the folder on the server but is not shared, why does it has to be shared for UNC to work, I will check into it?
J
Yes, when the connection is local "c:\folder" it does work fine, is when I have the database on a server and the connection is through the LAN that the connection does not work, I tried with the "; " at the end and the error still the same.
D
Thanks anyways
Thanks gurus for battling with me
-
Sep 17th, 2007, 08:53 PM
#6
Re: UNC path
 Originally Posted by GUARO
I have the folder on the server but is not shared, why does it has to be shared for UNC to work...
Because you need to have permissions setup - no one can access your drive (or folder within it) unless authorized.
Basically the same (but more even restrictive) goes for actual servers - you can have permissions setup on a single file.
-
Sep 17th, 2007, 08:59 PM
#7
Thread Starter
Addicted Member
Re: UNC path
R.
Thanks for battling with me here
The folder has the right permissions setup but the folder is not shared, if that is what you mean, I must be missing something because I still dont see the reason for sharing the folder in order for UNC to work but I will give a try at this point
Thanks again
-
Sep 17th, 2007, 09:27 PM
#8
Re: UNC path
See this article: Connecting to an Access DB on a Server
From there: "..the directory where the file is located needs to be mapped as a network drive on your computer."
EDIT: ..But don't declare/instantiate the Connection like in that article, do it like this..
Code:
Dim lCon As Adodb.Connection
Set lCon = New Adodb.Connection
'F:\ is the shared folder mapped as a Network Drive
lCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\MyDB.mdb"
lCon.Open
Last edited by jcis; Sep 17th, 2007 at 09:33 PM.
-
Sep 17th, 2007, 10:19 PM
#9
Re: UNC path
Well even if you map a drive to the folder, it still needs to be shared... or the drive needs to be shared.
That is how the security works...
-
Sep 17th, 2007, 10:19 PM
#10
Thread Starter
Addicted Member
Re: UNC path
J
Thanks for that articule and the help.- but this mapping does not make it any easier when you have 25 user to deploy the app. then you need to create 25 mapping on each computer to work.
Is there another way for UNC to work on access database that you may know.
Thanks again to all.
-
Sep 17th, 2007, 10:22 PM
#11
Re: UNC path
You CANNOT access someone else's computer unless you go thru security. It does not matter if you like it or not that is the way it is done and for good reason.
-
Sep 18th, 2007, 07:34 AM
#12
Thread Starter
Addicted Member
[ RESOLVED]Re: UNC path
Thanks all for your help,
Even thu the folder had the right permissions, in order for UNC to work the folder has to be shared.
Thanks a bunch again gurus
-
Sep 18th, 2007, 07:37 AM
#13
Re: [RESOLVED] UNC path
Not only shared but ensure that any user has write, create file, modify file, delete file for any folder that they will access an MS Access database in. Remember the user needs to create the lock file (.ldb) if it doesn't exsist and alos delete if they are the last person in and leave.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Sep 18th, 2007, 11:43 AM
#14
Re: UNC path
 Originally Posted by GUARO
J
when you have 25 user to deploy the app. then you need to create 25 mapping on each computer to work.
Incorrect.
1 drive mapped on each computer. The idea is: there is a computer(Server) with the database and the Clients connect to it.
-
Sep 18th, 2007, 12:49 PM
#15
Re: [RESOLVED] UNC path
Mapping drives for data access is dangerous - drive letter can simply be taken already, user may disconnect it and map it back but link to a different letter ... and so on ...
Long, story short - using UNC is much safer approach for file based db (such MS Access).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|