A facility to use MS Access databases is often offered on Microsoft web servers - seldom if ever on Linux Servers. Scripts provide for using SQL for creating, updating, appending and querying MS Access datasets (single or joined sets of tables on a client/server basis. Other features of MS Access, its internal Forms, Reports, Macros and Modules are not available online. The most common scripting language is ASP - with VB Script or possibly Jscript (virtually the same as Javascript). It is also possible to use php as the scripting language, which some may consider to have an advantage over ASP. Perl is also frequently used to script SQL queries, but is not covered here.
Probably the most common connection procedure is to set up a ODBC Data Source
and Dataset Name (DSN). If this facility is provided, it can be used to connect
to almost any of the popular database systems for which an ODBC driver is available.
However on many Microsoft Servers, an alternative "DSN-less" connection protocol
is offered based OLE DB.
The important statements which implement the connection are Server.CreateObject(),
oConn.Open() & oConn.Execute(). See the ASP script example below. This uses VBscript
ie the same Visual Basic script employed in standalone MS Access applications but with
additional ADO data access statements .
|
Contacts within the Authors Database: <% Dim oConn Dim oRs Dim filePath Dim Index ' Map authors database to physical path filePath = Server.MapPath("./../../incl/auth.mdb") ' Create ADO Connection Component to connect with sample database Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath ' Execute a SQL query and store the results ' within recordset Set oRs = oConn.Execute("SELECT * From authors") %>
|