JDBC连接Oracle问题:The network Adapter could not establish the connetion.

fancuixia 2004-04-08 05:09:00
JDBC连接Oracle问题:The network Adapter could not establish the connetion.

我查了资料,据说是因为Oracle是提供了MTS服务,导致此问题发生。
我看了Oracle中关于MTS的说明,可能必须提供MTS服务才行。是否有什么方法在不停止Oracle MTS 服务的情况下,用JDBC访问Oracle?

...全文
1050 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fancuixia 2004-04-13
  • 打赏
  • 举报
回复
已经通过OCI连接方式连通数据库。
fancuixia 2004-04-09
  • 打赏
  • 举报
回复
试一下先
fancuixia 2004-04-09
  • 打赏
  • 举报
回复
From: Jon Haugsand <Jon-H.Haugsand@norges-bank.no>
Date: 19 Nov 2001 10:47:25 +0100
Message-ID: <m3u1vrhz2q.fsf_-_@norges-bank.no>
Subject: [suse-oracle] Jdbc thin driver problem solved (was: jdbc thin driver: connection refused


Short summary: If you have problems with connecting your NT client to
your Linux server using jdbc thin client, be sure that the server
machine name as known at the server exists at the client (and is the
same name).


Long story:


* Jon Haugsand
> To all who have tried to help me, thanks. I have now gotten some help
> from Oracle and though they could not find the cause of my problem,
> they found a way to live with it. (They suspect some bad
> configuration.) Here is a summary of the problem and the suggested
> cure, just in case others should struggle with the same problem.
>
> I have two Oracle servers, one Linux and one NT. I have two Oracle
> clients, one Linux and one NT. All in all, four machines
> interconnected through tcp/ip. Each client attempts to connect to
> each server using both standard protocol (?), e.g. using sqlplus and
> the jdbc thin driver, all in all I have 8 connection scenarios.
>
> Oracle on Linux is 8.1.7 (both server and client).
> Oracle on NT is 8.1.6 (both server and client).
> Several jdbc thin drivers are tested, including the latest downloaded
> from Oracle.
>
> Linux server NT server
> ------------------------------------------------------------
> Linux sqlplus OK OK
> Linux jdbc thin OK OK
> NT sqlplus OK OK
> NT jdbc thin fails OK
>
> Driver is oracle.jdbc.driver.OracleDriver
>
> The connection string used: jdbc:oracle:thin:@192.168.22.35:1521:ora8
>
> The NT jdbc thin client failed with:
> java.sql.SQLException: Io exception: The Network Adapter could
> not establish the connection
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
> at
> oracle.jdbc.driver.OracleConnection.<init>
> (OracleConnection.java:361) at
> oracle.jdbc.driver.OracleDriver.getConnectionInstance
> (OracleDriver.java:442)
> at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
> at java.sql.DriverManager.getConnection(DriverManager.java:517)
> at java.sql.DriverManager.getConnection(DriverManager.java:177)
> at Nytest.main(Nytest.java:54)
> java.lang.RuntimeException: SQL Exception Io exception:
> The Network Adapter could not establish the connection
> at Nytest.main(Nytest.java:70)
>
>
> Failed connection enters the listener which does not complain, but no
> activity is found on the server. (That is, I do not know how to
> measure such things. The trace and log files were almost, but not
> completely, empty and obscure.)
>
> A curious observation is that if I restart the listener at the Linux
> server, the NT jdbc thin client works for a few minutes, and then
> fails again.
>
> --------------------------------
> OK, then the CURE:
>
> The Oracle support suggested I use the following (white space free)
> connection string (structured here for readability):
>
> jdbc:oracle:thin:@(DESCRIPTION=
> (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
> (HOST=192.168.22.35)
> (PORT=1521)))
> (CONNECT_DATA=(INSTANCE_NAME=ora8)
> (SERVICE_NAME=sil2002.norges.bank.no)))
>
> Lo and behold, this works. Thanks again for all helpfullness on this
> email list.


(Just after I sent this information, I discovered something. The
following is a copy of what I sent to the Oracle team.)

I have now discovered what might be the cause of the problem, and
I suggest that you test this out, and eventually report this to the
network development folks in your company.


What have been the situation up to now is that the Linux server has
not been a part of the local DNS i our company. That is, the server
name (banklab3) was not known as such at the NT client. Therefore, I
had to use the IP address. However, the server itself, and the Linux
client, uses the /etc/hosts file to be able to map from number to name
and vica versa.


Today, we inserted the Linux server banklab3 into the local DNS server such
that the NT client now knows that banklab3 has the matching IP address.


Today we have no problems with using the jdbc thin client as we had before.


Can it be so that the Oracle server at the Linux machine does not
"feel comfortable" with numbers and maps the IP address to its name
and returns this to the client, which does not accept this because it
does not know anything about this name?


If so, this is ceratinly not a preferred behaviour of the server, who
should respect the clients view of the world. (I humbly still admit
that there may also be some configuration problems with our Linux
server that makes this really a complex multi cause problem.)

moroser 2004-04-08
  • 打赏
  • 举报
回复
可能是你的监听器没启动
步骤:oracle安装目录-----》BIN----》TNSLSNR 双击启动
试一下
hellion1234 2004-04-08
  • 打赏
  • 举报
回复
最好在hosts文件加上域名解析,例如:

database 192.168.2.2

然后你的url就可以这样:jdbc:oracle:thin:@database:1521:check_db
Arias 2004-04-08
  • 打赏
  • 举报
回复
我也遇到这个问题了 我在本机上(win)系统上调连接就 出现了
但是把文件放到数据库server上就没有问题了
fancuixia 2004-04-08
  • 打赏
  • 举报
回复
Oracle的SID为check_db。

如果URL为
jdbc:oracle:thin:@192.168.2.2:1521:dddddd

会报错:connection refused(......)。

如果 ID 地址错误,或端口错误,或SID为 check_db,也就是真正的SID,就报错:The network Adapter could not establish the connetion.

也就是我的连接是正常的。

同样的语句,连接Windows 2000上的Oracle没有问题,有问题的是安装在Linux服务器上的Oracle。

望不吝指教。
内容概要:本文围绕“基于交流潮流的电力系统多元件N-k故障模型研究”展开,深入探讨了利用Matlab代码实现电力系统在发生多个关键元件同时故障(即N-k故障)情况下的交流潮流计算与故障分析方法。该模型不仅考虑了传统潮流方程的非线性特性,还引入了故障约束条件,能够精确模拟复杂多样的故障场景,如短路、断线等,进而评估电网在极端运行条件下的稳态与动态行为。研究通过构建典型电力系统算例,验证了所提模型在故障筛选、脆弱性识别及系统恢复策略制定方面的有效性,为电力系统安全评估、风险预警和防御体系构建提供了坚实的理论依据和技术支撑。此外,模型具备良好的扩展性,可进一步应用于连锁故障传播分析、恶意攻击模拟等高级安全分析领域。; 适合人群:具备电力系统分析基础理论知识和Matlab编程能力的高校研究生、科研院所研究人员以及电力公司从事电网规划、运行与安全管理的技术人员,特别适用于开展电力系统安全稳定、可靠性评估与应急响应机制研究的专业人士。; 使用场景及目标:①开展电力系统在多重故障条件下的交流潮流仿真,评估系统电压稳定性、线路过载风险及负荷损失程度;②识别电网中的关键薄弱环节与脆弱元件,支撑电网加固改造与防御资源配置;③用于科研项目中的故障场景建模与算法验证,或作为教学案例帮助学生理解复杂故障下的系统响应机制。; 阅读建议:此资源以Matlab代码为核心实现手段,建议读者结合理论推导与代码实现进行对照学习,重点关注故障建模过程中雅可比矩阵的修正方法、故障注入方式及收敛性处理策略,建议在仿真中逐步增加故障数量与复杂度,深入理解N-k故障对系统潮流分布的影响规律,并尝试将其拓展至含新能源接入的现代电力系统场景中进行验证与优化。

81,110

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧