Oracle920 and ASP connection problem solutions

xiaoxiao2021-03-06  14

Oracle920 and ASP connection problem solutions

code show as below:

<%

ON Error ResMe next

'Connect to the database

Set ORASESSION = CreateObject ("OracleinProcser.xorative)

Set ORADATABASE = ORASESSION.DBOPENDATABASE ("Database Name", "User Name / Password", 0)

'Error handling

IF err.number> 0 THEN

Response.write "

ASP error control "

Response.write "ASP Error Source:" & Err.Source & "
"

Response.write "ASP error code:" & Err.Number & "
"

Response.write "ASP error Description:" & Err.Description & "
"

Err.clear

Response.write "

Oracle OLE error control "

Response.write "Oracle Error Code" & ORASESSION.LastServererr & "
"

Response.write "Oracle Error" & ORASESSION.LastServererrtext & "
"

CloseDatabase

DisplayError

Response.end

END IF

'Close the database

SUB CloseDatabase ()

ORADATABASE.CLOSE

'set ORADATABASE = Nothing

ORASession.Close

Set ORASESSION = Nothing

End Sub

Function DisplayError ()

IF Err.Number <> 0 THEN

Response.Write "


database connection fails, contact your system administrator! "

Response.end

END IF

END FUNCTION

%>

Solution:

1. When IIS wants to access the Oracle database, in OLEDB, it is permissions (which is Oracle's bug)

Add / edit "Authenticated Users" users in the properties of ORA92 directory in Oracle_Home Directory, first don't choose, click on its "Read and Run" permissions, then select, and then "Apply".

2, there is a "SQLNET.ORA" file in the Oracle_Home directory ORA92 / NETWORK / Admin directory,

The content is as follows:

# SQLNET.ORA NETWORK Configuration File: E: /Oracle/ora92/neetwork/admin/sqlnet.ora

#Enerated by Oracle Configuration Tools.

Names.default_domain = jgc-new.local

SQLNET.AUTHENTICATION_SERVICES = (NTS)

Names.directory_path = (TNSNAMES, ONAMES, HOSTNAME) changed to:

# SQLNET.ORA NETWORK Configuration File: E: /Oracle/ora92/neetwork/admin/sqlnet.ora

#Enerated by Oracle Configuration Tools.

Names.default_domain = jgc-new.local

# SQLNET.AUThentication_Services = (NTS)

Names.directory_Path = (Tnsnames, onames, hostname)

转载请注明原文地址:https://www.9cbs.com/read-46664.html

New Post(0)