• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >JSP > JDBC连接Oracle数据库常见问题及解决方法

JDBC连接Oracle数据库常见问题及解决方法

作者: 字体:[增加 减小] 来源:互联网 时间:2017-05-11

通过本文主要向大家介绍了jdbc连接oracle数据库,jdbc链接oracle数据库,oracle数据库jdbc,jdbc操作oracle数据库,jdbc连接oracle等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

注:本文是斑竹从JDBC & Transaction版摘录广大站友的提问以及各种解答整理而来,如果您认为本文的内容已触犯了您的权益,请联系管理员进行修改。

  1. Jbuilder正确连接 oracle 9i需要注意的几个问题
    • oracle8以上的应该都使用classes12.jar文件作为jdbc驱动;
    • 正确设置windows的classpath和jbuilder中的enterprise setup 、configure libraries,将casses12.jar路径正确添加到上述需要设置的地方;
    • 进入database pilot,在database pilot中,file---new 在driver列表中如果oracle的驱动是红色的,就说明你的oralce在jb中加载失败;
    • 若③没有错,则新建一个url:jdbc:oracle:thin:@(yourhostname):1521:(your sid)
    • 连接数据库的Username/password

    注:大部分站友的jbuilder连接oracle的问题都是由于没有正确配置classpath等引起的。

  2. 使用非XA方式连接ORACLE数据库

    在windows下配置Oracle_XA时要注意两点:

    #ORACLE 10
    Oracle_XA;xaosw;%ORACLE_HOME% dbms oraxa10.lib%ORACLE_HOME%precompibmsvcorasql10.lib

    #oracle 9
    Oracle_XA;xaosw;%ORACLE_HOME% dbms oraxa9.lib%ORACLE_HOME%precompibmsvcorasql9.lib

    Unix下
    Oracle_XA:xaosw:....

    第一:在windows 下 ORACLE_XA 和xaosw后面的是分号";",不是冒号":"
    第二:上面的这些LIB写在一行上,中间用空格分开,如果没有在系统的环境变量中设置ORACLE_HOME,就写绝对路径。

  3. JDBC操作ORACLE数据库时出现‘java.sql.SQLException:IO异常,不在流模式下'
    1. 用OracleStatment,,不要用java.sql.Statment
    2. 如果对已有连接进行setAutoCommit失败,则关闭该连接并重新建立一个连接
    3. 到ORACLE站点下载一个最新的JDBC Driver,如果操作LOB类型,用ORACLE自带的接口和类
  4. weblogic连接oracle问题:The Network Adapter could not establish the connection

    可能是服务器的监听停掉了,是数据库的问题,与应用无关;应该先检查一下oracle是否正常,用sql*plus连接一下数据库,看能否正常连接;

  5. Weblogic中使用Oracle连接池及Oracle备份的注意事项

    使用HP-UNIX,Weblogic 8.1,Oracle 9.2.0.5
    配置了一个普通的连接池,驱动程序采用oracle的Oracle's Driver(Thin) version 9.0.1, 9.2.0

    错误情况:
    结果使用数据库连接池时报错,说没有连接池资源了。实际上数据库的连接池完全空闲,并且测试也是对的,Oracle也是正常可以连接、使用的。

    问题根源:
    通过层层排错,发现原来后台在使用Oracle的exp备份一个只有同义词的用户,导致exp进程僵死。
    杀死exp、重启Oracle等无法解决问题,最终重启UNIX,禁止备份只有同义词的用户,问题解决。

    总结:
    应该是Oracle9的exp BUG导致连接池问题,不要使用exp倒出同义词

  6. 连接Oracle时抛出如下异常:java.sql.SQLException: Io exception:The Network Adapter could not establish connection一种产生原因

    Oracle Database Connection (from oracle.com)
    PROBLEM
    You are attempting to connect to an Oracle instance using JDBC and you are receiving the following error. 
       java.sql.SQLException: Io exception:
         The Network Adapter could not establish connection
       SQLException: SQLState (null) vendor code (17002)
    Any or all of the following conditions may also apply:
    1) You are able to establish a SQL*Plus connection from the same
       client to the same Oracle instance.
    2) You are able to establish a JDBC OCI connection, but not a Thin
       connection from the same client to the same Oracle instance.
    3) The same JDBC application is able to connect from a different
       client to the same Oracle instance.
    4) The same behavior applies whether the initial JDBC connection
       string specifies a hostname or an IP address.
    REDISCOVERY 
    To verify whether you are hitting this problem, verify whether the Oracle instance is configured for Multithreaded Server (MTS). If the Oracle instance is not configured for MTS, you are probably encountering a different problem. Otherwise, continue. Try forcing the JDBC connection to use a dedicated server instead of a shared server. This can be accomplished in several ways. For JDBC OCI or Thin, this can be done by reconfiguring the server for dedicated connections only. This approach, however, may not be feasible in many cases. In such cases, the following options apply: For JDBC OCI:  
    1) Add the (SERVER=DEDICATED) property to the TNS connect string
       stored in the tnsnames.ora file on the client.
    2) Set the user_dedicated_server=ON in sqlnet.ora on the client.
    For JDBC Thin:
    You must specify a full name-value pair connect string (the same as it might appear in the tnsnames.ora file) instead of the short JDBC Thin syntax. For example, instead of
    "jdbc:oracle:thin::port:sid"
    you would need to use a string of the form
    "jdbc:oracle:thin:@(DESCRIPTION="                    +
                           "(ADDRESS_LIST="              +
                               "(ADDRESS=(PROTOCOL=TCP)" +
                                        "(HOST=host)"    +                                      =
                                        "(PORT=port)"    +
                               ")"                       +
                           ")"                           +
                           "(CONNECT_DATA="              +
                               "(SERVICE_NAME=sid)"      +
                               "(SERVER=DEDICATED)"      +
                           ")"                           +
                         ")"
    If the connection works fine after having made these changes, it is very likely that this is the problem you are encountering. In this case, one last test will help to verify this fact.
    Log into the remote host on which the Oracle instance is

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • JDBC连接Oracle数据库常见问题及解决方法
  • JDBC板块精华整理20051226
  • 通过JDBC连接oracle数据库的十大技巧

相关文章

  • 2017-05-11JSP由浅入深(11)—— 标记库
  • 2017-05-11ajax+json+Struts2实现list传递实例讲解
  • 2017-05-11JSP生成静态页实践及其设计思想[转]
  • 2017-05-11jdbc操作mysql数据库实例
  • 2017-05-11JSP由浅入深(12)—— 表单编辑
  • 2017-05-11JBuilder2005单元测试之业务类介绍
  • 2017-05-11一个通用的jsp分页PageBean
  • 2017-05-11spring @component的作用详细介绍
  • 2017-05-11JSP语法Page指令
  • 2017-05-11jdbc连接数据库步骤深刻分析

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • JSP输出HTML时产生的大量空格和换行的去除方法
    • 请求转发jsp页面乱码问题的快速解决方法
    • JSP实现的简单分页示例
    • 纯JSP+DWR实现三级联动下拉选择菜单实现技巧
    • jsp简单自定义标签的forEach遍历及转义字符示例
    • Spring AOP代理详细介绍
    • struts2中action实现ModelDriven后无法返回json的解决方法
    • JSP实现登录功能之添加验证码
    • 什么是eclipse,eclipse的意思解析
    • Hibernate 查询方式总结

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有