Tomcat connect db is error

Tue Jul 21 09:59:25 GMT+08:00 2009: ??????URL???: jdbc:oracle:thin:@adsfe:1521:tst22

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

PROBLEM

You are attempting to connect to an Oracle instance using JDBC and you are receiving the following error.

Bugzero is proven

Go for it!

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:@host: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 running and execute the appropriate command to determine what the server 'thinks' its hostname is (i.e. the name that was configured when the server was installed and configured). For example, on a Unix host the 'hostname' command can be used for this purpose.

Using the name displayed (e.g. by the hostname command), exactly as it appeared (i.e. if the output from the hostname command had the domain name included, then include it), return to the client which was unable to connect and try pinging the server.

NOTE: It is critical that you attempt to ping the server using EXACTLY the same hostname you got from the server.

If you are unable to ping the server via this hostname, then you almost certainly hitting this problem. If not, this may be a new issue, but at least you will have found a workaround (i.e. use a dedicated connection).

EXPLANATION

To understand why this problem occurs, one must first understand the differences in how the listener handles connections to shared servers versus dedicated servers.

When connecting to a dedicated server, the client connects to the listener (via hostname or IP address). The listener then spawns a dedicated server process and hands off the socket used to accept the client connection to that server. The client and server then start communicating via the endpoints established by the initial connection. NOTE: There is only one connection in this case. When connecting to a shared server, the initial client connection to the listener is the same. However, with MTS, there is no need to spawn a new server process; a pool of shared processes already exists. Also, clients do not communicate directly with the server processes in MTS; rather, they communicate with a dispatcher.

For this reason, when setting up an MTS connection, the listener sends a redirect message back to the client asking the client to close the connection to the listener and connect to a dispatcher. The information in this message includes the hostname and a port number for the appropriate dispatcher. The redirect message will ALWAYS specify a hostname, even if the client initially provided an IP address.

If, for any reason, the hostname provided to the listener (e.g. by the 'hostname' or another command) doesn't agree with the hostname by which the server is known on the client, the connection fails.

On the other hand, if "(SERVER=DEDICATED)" already appears in the TNS connect string in tnsnames.ora or if "use_dedicated_server=ON" already appears in the sqlnet.ora file, you may find that SQL*Plus and/or JDBC OCI work fine, while JDBC Thin fails.

SOLUTION

Obviously, one solution is to use dedicated servers. However, this may not always be feasible.

The key is to make sure the hostname on both the client and server agree. This can be accomplished by reconfiguring either the client or the server, but there are things to be aware of in both cases.

If the server is configured to return a different hostname, then it is possible that other clients which used to work will now fail.

In some cases, it may not be feasible to reconfigure the client. For example, if the server version of the hostname does not include the domain, you would need to remove the domain portion of the hostname on the client; but, if the client needs to connect to more than one server with the same base name in different domains, this may not be possible, as the hostname may be ambiguous.

REFERENCES

bug# 1269734:  java.sql.SQLException: Io exception: The Network Adapter could not be found.

tomcat访问oracle卡死,tomcat无法连接到oracle相关推荐

  1. 不装客户端连接mysql_C#不安装oracle客户端,如何连接到oracle数据库

    在打开Program.cs的main函数中写测试代码就可以了.需要添加如下两个using: using Oracle.ManagedDataAccess.Client; using Oracle.Ma ...

  2. oracle导入表 忽略报错,oracle数据泵导入分区表统计信息报错(一)

    今天在进行数据泵导入操作时,发现一个bug. 数据库版本Oracle 10203 for Solaris RAC,执行导入在处理表的统计信息时报错,错误信息为:ORA-39083和ORA-917. 经 ...

  3. oracle元数据存储在表空间,oracle db中数据和元数据的概念

    本帖最后由 warehouse 于 2014-8-10 11:58 编辑 02年研究dw相关的产品和业务时第一次听说了元数据的概念,很多资料上是这样描述元数据的概念的:元数据是定义或者描述数据的数据. ...

  4. oracle exp执行失败,EXP-00056: 遇到 ORACLE 错误 25153

    执行导出方案时报错: EXP-00056: 遇到 ORACLE 错误 25153 ORA-25153: 临时表空间为空 EXP-00000: 导出终止失败 操作如下 M:\oracle\product ...

  5. oracle 00600 kccpb,【案例】Oracle报错ORA-00600 kccpb_sanity_check_2 恢复控制文件过程

    天萃荷净 运维DBA反映Oracle数据库报错ORA-00600 kccpb_sanity_check_2,分析原因为数据库无法启动用户重建控制文件导致部分数据文件异常 有客户数据库由于某种原因无法o ...

  6. oracle数据泵导入导出6,oracle 10g数据泵和导入导出性能对比(六)

    前一段时间在一次迁移中同时用到了数据泵和EXP,发现二者效率的差别还是相当大的.这里通过一个例子简单比较一下. 这篇文章同时使用直接路径和并行来加速数据泵导入. 上一篇结束了数据泵导入在非归档模式下获 ...

  7. oracle补丁版本查看的sql,Oracle、SQLServer、ArcSDE怎么查看版本、补丁 - ArcGIS技巧研讨 - 博客频道nbsp...

    在我们安装ArcSDE时都会首先要查看体系需求,只有这样,传奇土城花补丁,才干保证我们的服务器环境运行比拟稳固,以下是先容在应用不同数据库中怎么查看相应的安装版本,以及相干的安装补丁. Oracle ...

  8. 多方面,全访问的剖析Tomcat十大线程和四大通道

    tomcat服务器在JavaEE项目中使用率非常高,所以在生产环境对tomcat的优化也变得非常重要了. 本专题课在调优压测时我们选择tomcat9,那我们为什么选择9版本呢?因为9的性能更高,更稳定 ...

  9. 2021实施工程师面试记录(一) oracle,tomcat,Linux

    实施工程师面试记录(一) oracle,tomcat,Linux oracle 1.叙述一下oracle数据库的安装流程 windows: 下载后解压运行可执行文件,创建和配置数据库 系统类 选择桌面 ...

最新文章

  1. pageResponse - 让H5适配移动设备全家(移动端适配)1
  2. api key for Alpha Vantage
  3. docker部署下的nginx负载均衡时,无法获取真实ip的问题
  4. 为您详细解析防火墙的工作原理
  5. C4C的Rich text editor的JavaScript实现
  6. centOS 6 rpm安装MySQL小记
  7. java log4j基本配置及日志级别配置详解,java基础面试笔试题
  8. 黑马程序员 Python学习笔记之 程序执行原理(科普)
  9. 星空之夜(哈希+DFS)
  10. 数据库事务ACID四大特性:原子性、一致性, 隔离性, 持久性
  11. 0x120-从头开始写操作系统-启动扇区与内存的关系及内存寻址的应用
  12. python的MYSQLdb
  13. 如何在面试中回答 “你最大的缺点是什么?”
  14. Java Web应用开发简介
  15. 完整的软件开发流程是怎样的?
  16. opencv-python识别魔方特定颜色方块,并输出各方块中心坐标
  17. CarAudio音量调节详解
  18. spss连接至远程计算机,通过远程连接打开SPSS产品时,收到许可证错误信息。从本地打开同一产品时没有错误。...
  19. 人工智能对社会的发展
  20. 单商户商城系统功能拆解25—营销中心—优惠券

热门文章

  1. 无障碍开发(六)之ARIA在HTML中的使用规则
  2. vue2实现自定义样式radio单选框
  3. Dart基础学习03--方法的使用
  4. iOS推送小结--swift语言
  5. CVE-2014-6271 漏洞告警
  6. LeetCode 147. Insertion Sort List 链表插入排序 C++/Java
  7. 【题解】Luogu P3674 小清新人渣的本愿
  8. 10 行 Java 代码实现 LRU 缓存
  9. JAVA之关于This的用法
  10. 动物麻醉剂量和途径相关要点