PDA

View Full Version : ConnectString for Access DB on a different machine


fractalvibes
08-15-2003, 02:42 AM
Ok, now I have a question! We have an older ASP app written circa 2000. It uses Access - about 16 tables and around 25 Access queries. The mandate is to move all Access databases, image files, etc. to a machine separate from the Server(s) for load balancing purposes. So - have tried putting a table on a NAS
(Network Addressable Storage) machine and connecting to the table via something like this:

If MDB is located on a Network Share

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\\myServer\myShare\myPath\myDb.mdb;" & _
"Uid=admin;" & _
"Pwd="

We don't use Access anymore, and when we did, we always place the *.mdb in the same folder(or subfolder) as the app, so I am totally unfamiliar with how this might work. Using the above formula for the connect string simply does not work. Any advice appreciated!

We use DB2 normally, for our database these days, and the app will eventually be converted, but we need a quick fix with minimal
tinkering with the thing for now...

thanks,
FractalVibes

ScottInTexas
08-15-2003, 04:51 PM
This works well for me and should connect for you. Instead of using the Server.MapPath you can substitue the entire path for your database.


Function GetConn()
Dim conn
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open( "entire path/BigDB.MDB")
GetConn=conn
End Function


Later in the code ...

objRS.Open SQL, conn, 3, 3



Hope this works for you.

fractalvibes
08-15-2003, 05:31 PM
Thanks, Scott. I tried your method and got the same result more or less :
(path changed to protect the innocent...)

The Microsoft Jet database engine cannot open the file '\\someserver\somepath\some.mdb'. It is already opened exclusively by another user, or you need permission to view its data.

Definitely a permissions problem with the NAS machine..

Phil J

oracleguy
08-15-2003, 06:49 PM
Perhaps, if you have access to the web server, just map a drive to the share on your NAS because then you will be assured that the appropriate permissions exist for the database driver to access the file if it lets you map a drive and view the contents.