
|
Setting Up and Using OraSession to Manage Your Oracle Database Objects By Nannette Thacker - 05/01/1999 Most ASP developers are familiar with data connections using ActiveX Data Objects (ADO). However, Oracle provides the OraSession object to manage collections of OraConnection, OraDatabase, and OraDynaset objects used within your application. You must first create a data control using Oracle's SQL*Net Easy Configuration. Select SQL*Net Easy Configuration from your Program menu.
Select the radio button to "Add Database Alias." Then select "OK."
Type in the name of the alias to identify the database you wish to access. This can be any name you wish to give it.
Select the Protocol.
Type in either the Host Name or IP address of the server and the Database Instance.
Then confirm the addition of this instance:
Now you are ready to use this connection in your ASP pages. I create include files (with an .asp extension) to open and close my data connections. In the database.asp include file I would include functions to open and close the data connections. The include file would be included at the top of the asp page which utilizes data connections. Then, the open and close functions could be called as needed:
<% ' Declare OLE object variables Dim ses As Object Dim db As Object Sub DataOpen
' Create the OraSession Object
set ses = CreateObject("OracleInProcServer.XOraSession")
' Open a connection to Oracle
set db = ses.OpenDatabase("DemoDB","Username/Password",0)
End SubSub DataClose ' Close the connection db.Close Set db = Nothing End Sub %>When you are ready to call these functions, include the database.asp file in your ASP page and call them where needed: <!--#include virtual="/include/database.asp"-->
|
|
