0 then Response.Write " asp 错误控制 " Response.Write "asp 错" name="description" />

ORACLE920与ASP的连接问题的解决办法

发表于:2007-06-30来源:作者:点击数: 标签:
代码如下: 数据库 Set OraSession = CreateObject("OracleInProcServer.XOraSession") set oradatabase=orasession.dbopendatabase("数据库名","用户名/密码",0) @#出错处理 if err.number >0 then Response.Write " asp 错误控制 " Response.Write "asp 错
代码如下: <% 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.local SQLNET.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)

原文转自:http://www.ltesting.net