ORACLE920與ASP的連接問題的解決方法
作者:Eve Cole
更新時間:2009-06-24 17:20:02
程式碼如下: <% 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 the Response.
資料庫連線失敗,請與系統管理員聯絡!
" Response.End end if end function %> 解決方法: 1、IIS要存取ORACLE資料庫時,在OLEDB中賦於一個權限(是ORACLE的BUG) 在ORACLE_HOME目錄下ORA92目錄的屬性裡的安全性上新增/編輯「Authenticated Users」用戶,在其「讀取及運行」權限上先點不選,再點選擇,然後「應用」。 」文件, 內容如下: # SQLNET.ORA Network Configuration File: E:oracleora92networkadminsqlnet.ora # Generated by Oracle configuration tools. NAMES.DEFAULT_DOMAIN = jgc-new.local SQLNET.AUTHENTICATION_SERVI=CES=CES (NTD-new.local SQLNET.AUTHENTICATION。 ) NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME) 改為: # SQLNET.ORA Network Configuration File: E:oracleora92networkadminsqlnet.ora # Generated by Oracle configuration tool. jgc-new.local # SQLNET.AUTHENTICATION_SERVICES= (NTS) NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)