ORACLE920與ASP的連接問(wèn)題的處理方法
發(fā)表時(shí)間:2024-06-03 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]代碼如下:<% on error resume next '連接數(shù)據(jù)庫(kù) Set OraSession = CreateObject("OracleInProcServer.XOraSession") set oradatabase=orasession.d...
代碼如下:<% on error resume next '連接數(shù)據(jù)庫(kù) Set OraSession = CreateObject("OracleInProcServer.XOraSession") set oradatabase=orasession.dbopendatabase("數(shù)據(jù)庫(kù)名","用戶(hù)名/密碼",0) '出錯(cuò)處理 if err.number >0 then Response.Write "
asp 錯(cuò)誤控制
" Response.Write "asp 錯(cuò)誤來(lái)源:"&err.Source &"
" Response.Write "asp 錯(cuò)誤代碼:"&err.number &"
" Response.Write "asp 錯(cuò)誤說(shuō)明:"&err.Description &"
" err.Clear Response.Write "
ORACLE OLE 錯(cuò)誤控制
" Response.Write "ORACLE 錯(cuò)誤代碼"&OraSession.lastServerErr&"
" Response.Write "ORACLE 錯(cuò)誤說(shuō)明"&OraSession.lastServerErrtext&"
" closeDatabase displayerror Response.end end if '關(guān)閉數(shù)據(jù)庫(kù) 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ù)庫(kù)連接失敗,請(qǐng)與系統(tǒng)管理員聯(lián)系!
" Response.End end if end function %>解決辦法:1、IIS要訪問(wèn)ORACLE數(shù)據(jù)庫(kù)時(shí),在OLEDB中賦于一個(gè)權(quán)限(是ORACLE的BUG)在ORACLE_HOME目錄下ORA92目錄的屬性里的安全性上添加/編輯“Authenticated Users”用戶(hù),在其“讀取及運(yùn)行”權(quán)限上先點(diǎn)不選,再點(diǎn)選擇,然后“應(yīng)用”。2、在ORACLE_HOME目錄下ORA92\network\ADMIN目錄里有一個(gè)“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)