ORACLE920与ASP的连接问题的解决办法
2005-03-21 10:32:03 来源:WEB开发网核心提示:代码如下:<% on error resume next '连接数据库 Set OraSession = CreateObject("OracleInProcServer.XOraSession") set oradatabase=orasession.dbopendataba
代码如下:
<%
on error resume next
'连接数据库
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
set oradatabase=orasession.dbopendatabase("数据库名","用户名/密码",0)
'出错处理
if err.number >0 then
Response.Write "
" Response.Write "asp 错误代码:"&err.number &"
" Response.Write "asp 错误说明:"&err.Description &"
" err.Clear Response.Write "
" 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 "
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)- ››oracle 恢复误删除的表和误更新的表
- ››asp.net页面弄成伪静态页面
- ››Oracle分页查询排序数据重复问题
- ››Oracle创建dblink报错:ORA-01017、ORA-02063解决
- ››Oracle 提高SQL执行效率的方法
- ››Oracle 动态查询,EXECUTE IMMEDIATE select into...
- ››Oracle 11g必须开启的服务及服务详细介绍
- ››oracle性能34条优化技巧
- ››oracle数据库生成随机数的函数
- ››Asp.net 中将汉字转换成拼音的方法
- ››Oracle 数据库表空间容量调整脚本
- ››oracle单库彻底删除干净的方法
更多精彩
赞助商链接