Filed under:

DSNless connection to MS Access




Here are some examples of DSNless connections to MS Access - this is highly
recommended over using ODBC


This also assumes you have created a "private" folder in the FTP root for
your account.


Remember to replace your-account-name with your own account
name.



OLE DB Provider for Microsoft Jet For standard security (ie No db password
assigned)


oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:HSHomeyour-account-nameprivatedatabase-name.mdb;" & _
"User Id=admin;" & _
"Password="

If using a Workgroup (System Database)

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:HSHomeyour-account-nameprivatedatabase-name.mdb;" & _
"Jet OLEDB:System Database=MySystem.mdw", _
"myUsername", "myPassword"
Note, remember to convert both the MDB and the MDW to the 4.0

database format when using the 4.0 OLE DB Provider.



If MDB has a database password

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:HSHomeyour-account-nameprivatedatabase-name.mdb;" & _

"Jet OLEDB: Database Password=MyDbPassword", _
"myUsername", "myPassword"

If want to open up the MDB exclusively
oConn.Mode = adModeShareExclusive
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:HSHomeyour-account-nameprivatedatabase-name.mdb;" & _
"User Id=admin;" & _
"Password="
If MDB is located on a remote machine

- Upgrade to SQL Server and use an IP connection string



If you don't know the path to the MDB

<% ' ASP server-side code
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath(".") & "myDb.mdb;" & _
"User Id=admin;" & _
"Password="
%>
This assumes the MDB is in the same directory where the ASP page is running.
Also make sure this directory has Write permissions for the user account.

 



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Language: