ODBC
Driver for Access
For Standard Security:
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;" & _
"Uid=admin;" & _
"Pwd="
If you are using a Workgroup
(System database):
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;" & _
"SystemDB=c:\somepath\mydb.mdw;", _
"myUsername", "myPassword"
If want to open up the MDB
exclusively
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;" & _
"Exclusive=1;" & _
"Uid=admin;" & _
"Pwd="
If MDB is located on a Network
Share
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\\myServer\myShare\myPath\myDb.mdb;" & _
"Uid=admin;" & _
"Pwd="
If you don't know the path to the
MDB (using ASP)
<% ' ASP server-side code
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=" & Server.MapPath(".") & "\myDb.mdb;" & _
"Uid=admin;" & _
"Pwd="
%>
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.
If you don't know the path to the
MDB (using VB)
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=" & App.Path & "\myDb.mdb;" & _
"Uid=admin;" & _
"Pwd="
This assumes the MDB is in the
same directory where the application is running.
For more information, see: Microsoft
Access Driver Programming Considerations
To view Microsoft KB articles related to
Microsoft Access Driver, click
here
ODBC
Driver for MySQL (via MyODBC)
To connect to a local database
(using MyODBC Driver)
oConn.Open "Driver={mySQL};" & _
"Server=MyServerName;" & _
"Option=16834;" & _
"Database=mydb"
To connect to a remote database
oConn.Open "Driver={mySQL};" & _
"Server=db1.database.com;" & _
"Port=3306;" & _
"Option=131072;" & _
"Stmt=;" & _
"Database=mydb;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
To connect to a local database
(using MySQL ODBC 3.51 Driver)
oConn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _
"Server=myServerName;" & _
"Port=3306;" & _
"Option=16384;" & _
"Stmt=;" & _
"Database=mydatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
Or
oConn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=myServerName;" & _
"DATABASE=myDatabaseName;" & _
"USER=myUsername;" & _
"PASSWORD=myPassword;"
Note: When you first install MySQL,
it creates a "root" user account (in the
sys datbase's user table) with a blank password.
For more information, see: Programs
Known to Work with MyODBC
ODBC
Driver for Oracle - from Microsoft
For the current Oracle ODBC Driver
from Microsoft
oConn.Open "Driver={Microsoft ODBC for Oracle};" & _
"Server=OracleServer.world;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
For the older Oracle ODBC Driver
from Microsoft
oConn.Open "Driver={Microsoft ODBC Driver for Oracle};" & _
"ConnectString=OracleServer.world;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
For more information, see: Connection
String Format and Attributes
To view Microsoft KB articles related to
Microsoft ODBC for Oracle, click
here
ODBC
Driver for Oracle - from Oracle
oConn.Open "Driver={Oracle ODBC Driver};" & _
"Dbq=myDBName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
Where: The DBQ name must be
defined in the tnsnames.ora file
For more information, see: Oracle8
ODBC Driver Help, Oracle
ODBC FAQs, [asporacle]
listserv FAQs, and ASPDB
Oracle
ODBC
Driver for SQL Server
For Standard Security
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
For Trusted Connection security
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Uid=;" & _
"Pwd="
Or
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Trusted_Connection=yes"
To Prompt user for username and
password
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"DataBase=myDatabaseName"
To connect to SQL Server running
on the same computer
oConn.Open "Driver={SQL Server};" & _
"Server=(local);" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
To connect to SQL Server running
on a remote computer (via an IP address)
oConn.Open "Driver={SQL Server};" & _
"Server=xxx.xxx.xxx.xxx;" & _
"Address=xxx.xxx.xxx.xxx,1433;" & _
"Network=DBMSSOCN;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
Where:
- xxx.xxx.xxx.xxx is an IP address
- 1433 is the default port number for SQL Server.
- "Network=DBMSSOCN" tells ODBC to use
TCP/IP rather than Named
Pipes
For more information, see: SQLDriverConnect
(ODBC)
To view Microsoft KB articles
related to ODBC Driver for SQL Server, click
here
|