ASP
ASP (ActiveX Server Pages) is a language-independent framework designed by Microsoft to generate dynamic web content. It allows coding of server-side scripts that are executed by a Web server in response to a user's request for a URL. ASP scripts are similar to other server-side scripting technologies like JSP, PHP and PSP.
An ASP page is a standard ASCII text file that contains both HTML tags and scripting code. Typical scripting languages that can be embedded into ASP pages are VBScript and JavaScript. All scripting portions are delimited by tags. Example ASP page:
<html> Current date and time is: <% ' Start comments with "'" response.write "[/b]" response.write Now() ' writes the current date and time. %> </html>
Difference between ASP and JSP
Active Server Pages (ASP) is a Microsoft standard. ASP supports multiple scripting languages (VBScript, JavaScript, etc), but is limited to Microsoft supported platforms and software.
JSP supports customizable tags and is independent of platform and server technologies. Code is developed using the standard Java programming language. Either ODBC or JDBC is used to connect to Oracle (and other) databases. JSP is usually used for larger enterprise scale applications.
Web Servers for hosting ASP pages
Active Server Pages are supported on the following Web Servers:
- Microsoft Personal Web Server (PWS)
- Microsoft Internet Information Services (IIS)
- Some Unix Web Servers
Oracle connectivity
Follow these steps to ensure your server can connect to Oracle:
- Make sure that you can use simple ASP pages. Upload (FTP) the example above to your server and see if you can access it via a Web Browser.
- Install the Oracle Client CD on your server. This will install SQL*Net, OO4O (Oracle Objects for OLE) and the Oracle ODBC drivers on your system.
- Configure SQL*Net and ensure you can tnsping and connect your Oracle database. This is done by adding an entry to the TNSNAMES.ORA file or by using utilities like the "Net Easy Configurator" to do it for you. See the SQL*Net FAQ for details.
- Optionally configure ODBC by creating a System DSN (Data Source Name). This can be done from the "32-Bit ODBC Administrator" in the Control Pannel. Alternatively one can use OO4O (no configuration required), or "DSNless" ODBC connection. See the ODBC FAQ for details.
- You are ready to GO!!!
One can connect to Oracle from ASP Pages using the Oracle ODBC driver or OO4O (Oracle Objects for OLE) calls.
Look at this OO4O example:
<% Set OraSession = Server.CreateObject("OracleInProcServer.XOraSession") Set OraDatabase = OraSession.DbOpenDatabase("connect_str.world", "hr/hr",cint(0)) Response.Write "OO4O Version: " & OraSession.OIPVersionNumber & " " & _ "Username: " & OraDatabase.connect & " " & _ "Database Name: " & OraDatabase.DatabaseName & " " & _ "Oracle Version: " & OraDatabase.RDBMSVersion & " " Set osRecordSet = OraDatabase.DbCreateDynaset("SELECT TNAME FROM TAB", cint(0)) Response.write("<h1>Tables:</h1>") Do While(osRecordset.EOF = FALSE) Response.write(osRecordset.Fields("TNAME") & " ") osRecordSet.MoveNext Loop %>
The following example demonstrated ODBC connectivity:
<% Set OraDatabase = Server.CreateObject("ADODB.Connection") OraDatabase.Open "dsn=OracleDSN;uid=userid;pwd=password;" Set osRecordSet = OraDatabase.Execute("SELECT * FROM EMPLOYEE") Response.Write "<table border=1 cellpadding=4>"
Response.Write "" For I = 0 To osRecordSet.Fields.Count - 1 Response.Write "" & osRecordSet(I).Name & ""
Next
Response.Write "" Do While Not osRecordSet.EOF Response.Write "" For I = 0 To osRecordSet.Fields.Count - 1 Response.Write "" & osRecordSet(I) & ""
Next
Response.Write "" osRecordSet.MoveNext Loop Response.Write ""
osRecordSet.Close OraDatabase.Close %>
Also see
External links
Glossary of Terms | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | # |