ORACLE920與ASP的連接問題的處理方法
發(fā)表時間:2024-01-30 來源:明輝站整理相關軟件相關文章人氣:
[摘要]代碼如下:<% on error resume next '連接數(shù)據(jù)庫 Set OraSession = CreateObject("OracleInProcServer.XOraSession") set oradatabase=orasession.d...
代碼如下:<% on error resume next '連接數(shù)據(jù)庫 Set OraSession = CreateObject("OracleInProcServer.XOraSession") set oradatabase=orasession.dbopendatabase("數(shù)據(jù)庫名","用戶名/密碼",0) '出錯處理 if err.number >0 then Response.Write "
asp 錯誤控制
" Response.Write "asp 錯誤來源:"&err.Source &"
" Response.Write "asp 錯誤代碼:"&err.number &"
" Response.Write "asp 錯誤說明:"&err.Description &"
" err.Clear Response.Write "
ORACLE OLE 錯誤控制
" Response.Write "ORACLE 錯誤代碼"&OraSession.lastServerErr&"
" Response.Write "ORACLE 錯誤說明"&OraSession.lastServerErrtext&"
" closeDatabase displayerror Response.end end if '關閉數(shù)據(jù)庫 sub closeDatabase() oradatabase.close 'set oradatabase=nothing orasession.close set orasession=nothing end sub function displayerror() if err.number <>0 then Response.Write "
數(shù)據(jù)庫連接失敗,請與系統(tǒng)管理員聯(lián)系!
" Response.End end if end function %>解決辦法:1、IIS要訪問ORACLE數(shù)據(jù)庫時,在OLEDB中賦于一個權限(是ORACLE的BUG)在ORACLE_HOME目錄下ORA92目錄的屬性里的安全性上添加/編輯“Authenticated Users”用戶,在其“讀取及運行”權限上先點不選,再點選擇,然后“應用”。2、在ORACLE_HOME目錄下ORA92\network\ADMIN目錄里有一個“sqlnet.ora”文件,內(nèi)容如下:# SQLNET.ORA Network Configuration File: E:\oracle\ora92\network\admin\sqlnet.ora# Generated by Oracle configuration tools.NAMES.DEFAULT_DOMAIN = jgc-new.localSQLNET.AUTHENTICATION_SERVICES= (NTS)NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)將其改為:# SQLNET.ORA Network Configuration File: E:\oracle\ora92\network\admin\sqlnet.ora# Generated by Oracle configuration tools.NAMES.DEFAULT_DOMAIN = jgc-new.local# SQLNET.AUTHENTICATION_SERVICES= (NTS)NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)