ORACLE920與ASP的連接問題的處理方法
發表時間:2024-06-03 來源:明輝站整理相關軟件相關文章人氣:
[摘要]代碼如下:<% on error resume next '連接數據庫 Set OraSession = CreateObject("OracleInProcServer.XOraSession") set oradatabase=orasession.d...
代碼如下:<% on error resume next '連接數據庫 Set OraSession = CreateObject("OracleInProcServer.XOraSession") set oradatabase=orasession.dbopendatabase("數據庫名","用戶名/密碼",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 '關閉數據庫 sub closeDatabase() oradatabase.close 'set oradatabase=nothing orasession.close set orasession=nothing end sub function displayerror() if err.number <>0 then Response.Write "
數據庫連接失敗,請與系統管理員聯系!
" Response.End end if end function %>解決辦法:1、IIS要訪問ORACLE數據庫時,在OLEDB中賦于一個權限(是ORACLE的BUG)在ORACLE_HOME目錄下ORA92目錄的屬性里的安全性上添加/編輯“Authenticated Users”用戶,在其“讀取及運行”權限上先點不選,再點選擇,然后“應用”。2、在ORACLE_HOME目錄下ORA92\network\ADMIN目錄里有一個“sqlnet.ora”文件,內容如下:# 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)