Home page   WebCheatSheet.com


MS Access Connection Strings


ODBC Connection Strings

 Standard Security:

<%
'declare the variable that will hold the connection string
Dim ConnectionString 
'define connection string, specify database driver and location of the database
ConnectionString="Driver={MicrosoftAccessDriver(*.mdb)};" &_
"DBQ=C:\your_database_name.mdb;Uid=your_username;Pwd=;"
%>

 Workgroup:

<%
'declare the variable that will hold the connection string
Dim ConnectionString 
'define connection string, specify database driver and location of the database
ConnectionString="Driver={Microsoft Access Driver (*.mdb)}; Dbq=c:\your_database_name.mdb;" &_
"SystemDB=C:\your_database_name.mdw;"
%>

 Exclusive:

<%
'declare the variable that will hold the connection string
Dim ConnectionString 
'define connection string, specify database driver and location of the database
ConnectionString="Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:\your_database_name.mdb;" &_
"Exclusive=1; Uid=your_username; Pwd=;"
%>

OLE DB and OleDbConnection (.NET framework) Connection Strings

 Standard Security:

<%
'declare the variable that will hold the connection string
Dim ConnectionString 
'define connection string, specify database driver and location of the database
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\your_database_name.mdb;" &_
"User Id=admin; Password=;"
%>

 Workgroup (System Database):

<%
'declare the variable that will hold the connection string
Dim ConnectionString 
'define connection string, specify database driver and location of the database
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\your_database_name.mdb;" &_
"Jet OLEDB:System Database=c:\system.mdw;"
%>

 Password protected Access database:

<%
'declare the variable that will hold the connection string
Dim ConnectionString 
'define connection string, specify database driver and location of the database
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\your_database_name.mdb;" &_
"Jet OLEDB:Database Password=your_password;"
%>

 Access database located on a network share:

<%
'declare the variable that will hold the connection string
Dim ConnectionString 
'define connection string, specify database driver and location of the database
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=\\server_name\share_name\share_path\your_database_name.mdb"
%>

 Access database located on a remote server::

<%
'declare the variable that will hold the connection string
Dim ConnectionString 
'define connection string, specify database driver and location of the database
ConnectionString="Provider=MS Remote; Remote Server=http://your_remote_server_ip;" &_
"Remote Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\your_database_name.mdb"
%>


Copyright © 2005-2007 www.WebCheatSheet.com All Rights Reserved.