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;" & _Note, remember to convert both the MDB and the MDW to the 4.0
"Data Source=D:HSHomeyour-account-nameprivatedatabase-name.mdb;" & _
"Jet OLEDB:System Database=MySystem.mdw", _
"myUsername", "myPassword"
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 = adModeShareExclusiveIf MDB is located on a remote machine
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:HSHomeyour-account-nameprivatedatabase-name.mdb;" & _
"User Id=admin;" & _
"Password="
- Upgrade to SQL Server and use an IP connection string
If you don't know the path to the MDB
<% ' ASP server-side codeThis assumes the MDB is in the same directory where the ASP page is running.
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath(".") & "myDb.mdb;" & _
"User Id=admin;" & _
"Password="
%>
Also make sure this directory has Write permissions for the user account.
Add to Favourites Print this Article
Also Read