oracle连接出错,Thevm network adapterr could not establish the connection

Oracle连接的问题:The Network Adapter could not establish the connection
我的网站在发布时遇到了一下的问题:
14:32:47,304 WARN : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@184a07c -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
& & & & at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
& & & & at oracle.jdbc.driver.PhysicalConnection.&init&(PhysicalConnection.java:546)
& & & & at oracle.jdbc.driver.T4CConnection.&init&(T4CConnection.java:236)
& & & & at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
& & & & at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
& & & & at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
& & & & at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
& & & & at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
& & & & at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
& & & & at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
& & & & at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
& & & & at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
& & & & at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
& & & & at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:392)
& & & & at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:434)
& & & & at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:687)
& & & & at oracle.net.ns.NSProtocol.connect(NSProtocol.java:343)
& & & & at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
& & & & at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
& & & & ... 12 more
Caused by: java.net.ConnectException: Connection timed out
& & & & at java.net.PlainSocketImpl.socketConnect(Native Method)
& & & & at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
& & & & at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
& & & & at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
& & & & at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
& & & & at java.net.Socket.connect(Socket.java:546)
& & & & at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:150)
& & & & at oracle.net.nt.ConnOption.connect(ConnOption.java:133)
& & & & at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:370)
& & & & ... 17 more
数据库连接:
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@dasdwwwww.exadata.eeaseee.se:1521/SEANPRD
jdbc.user=DBUSER
jdbc.pass=DBPASSWORD
@Bean(name="dataSource", destroyMethod="close")
public DataSource bamsDataSource() throws PropertyVetoException {
&&&&ComboPooledDataSource dataSource = new ComboPooledDataSource();
&&&&dataSource.setDriverClass(env.getProperty("jdbc.driverClassName"));
&&&&dataSource.setJdbcUrl(env.getProperty("jdbc.url"));
&&&&dataSource.setUser(env.getProperty("jdbc.user"));
&&&&dataSource.setPassword(env.getProperty("jdbc.pass"));
&&&&dataSource.setCheckoutTimeout(10000);
&&&&dataSource.setMinPoolSize(1);
&&&&dataSource.setMaxPoolSize(15);
&&&&dataSource.setMaxStatements(50);
&&&&dataSource.setMaxIdleTime(1200);
&&&&dataSource.setIdleConnectionTestPeriod(6000);
&&&&return dataS
具体细节是这样的:
我的网站需要远程访问另一个网站的数据库,应对方网站提供的连接信息,我可以通过电脑上的Client连接并且访问对方的数据库,我的网站在我本机的Eclipse上运行也可以访问对方的数据库。
但是当我发布我的网站到服务器上的时候,是连接不上的。从我的服务器,我可以ping通,telnet 和 traceroute到对方的网站。
请问我还有什么对方没有配置好?
条件允许的话,可以在你的服务器上装一个测试一下能不能连接上对方数据库。
可以问一下对方的服务器上的oracle数据库是不是做了ip限制,可以参考这个
另外,你的服务器上是否有防火墙,如果是,尝试关闭或者增加规则允许访问1521端口
是否对方的网站oracle服务器配置了允许接入的IP段?
引用来自“rayeaster”的评论
条件允许的话,可以在你的服务器上装一个测试一下能不能连接上对方数据库。
可以问一下对方的服务器上的oracle数据库是不是做了ip限制,可以参考这个
另外,你的服务器上是否有防火墙,如果是,尝试关闭或者增加规则允许访问1521端口
装了,依然连不上。后来我问IP部门,发现是防火墙的问题。现在联通了。
引用来自“rayeaster”的评论
条件允许的话,可以在你的服务器上装一个测试一下能不能连接上对方数据库。
可以问一下对方的服务器上的oracle数据库是不是做了ip限制,可以参考这个
另外,你的服务器上是否有防火墙,如果是,尝试关闭或者增加规则允许访问1521端口
引用来自“舒克贝塔”的评论装了,依然连不上。后来我问IP部门,发现是防火墙的问题。现在联通了。嗯,一般都是iptables(防火墙)的问题。如果我的回答对你有帮助,麻烦采纳我的答案为“最佳答案”吧:)君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
连接sqlserver 出现 The Network Adapter could not establish the connection
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口状况:Oracle11g + MyEclipse 6.5 + JDK1.6标题:JDBC毗邻Oracle数据库泛起以下舛误:java.sql.SQLRecoverableException: Io 无比: The Network Adapter could not establish the connectionat oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:101)at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:458)at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)at oracle.jdbc.driver.PhysicalConnection.&init&(PhysicalConnection.java:490)at oracle.jdbc.driver.T4CConnection.&init&(T4CConnection.java:202)at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)at java.sql.DriverManager.getConnection(Unknown Source)at java.sql.DriverManager.getConnection(Unknown Source)at chap6.DBUtil.getConnection(DBUtil.java:14)at chap6.StatementDemo.main(StatementDemo.java:15)java.sql.SQLException: 驱动纰谬或邻接败北!at chap6.DBUtil.getConnection(DBUtil.java:20)at chap6.StatementDemo.main(StatementDemo.java:15)解决:关闭防火墙整治标题。若是封锁防火墙不克不及打算标题。
(福建厦门)
小豆豆豆豆
豆豆豆的最新日记
······
&(1人喜欢)
······
你论文写完了吗? · 151条内容
就是那么简单几句我办不到 · 2234条内容
博物馆讲述难以言说的历史 · 349条内容
纪念汪老逝世二十周年 · 154条内容
以赤子之心澄澈映照世界 · 115条内容
你是一本读不完的书 · 879条内容
推荐这篇日记的豆列
······查看: 118206|回复: 22
郁闷的The Network Adapter could not establish the connection
论坛徽章:1
郁闷的The Network Adapter could not establish the connection
各位大虾,最近碰到很奇怪的事,如果访问量大的话,常报The Network Adapter could not establish the connection的错,但同一个程序别的类调用数据库连接却能联上,而且报这种错的类是不一定的,有时这个类报这个错,有时另外一个类报这个错的,我的程序是多线程的,现在很苦恼,查了一两天都没查出来原类,用户那边正在抱怨着呢,领导要求最近一定要查出来,请大家帮忙看看是什么原因,多谢了:
我的数据库驱动程序是classes12.jar ,数据库连接用的是odbcracle:thin:@172.18.26.89:1521racl
驱动为oracle.jdbc.driver.OracleDriver
我换了classes14.jar,驱动racle.jdbc.OracleDriver,也报这个错
我将ora文件的process调成500个,还报这个错
论坛徽章:9
Re: 郁闷的The Network Adapter could not establish the connection
最初由 北极羊 发布
[B]郁闷的The Network Adapter could not establish the connection
各位大虾,最近碰到很奇怪的事,如果访问量大的话,常报The Network Adapter could not establish the connection的错,但同一个程序别的类调用数据库连接却能联上,而且报这种错的类是不一定的,有时这个类报这个错,有时另外一个类报这个错的,我的程序是多线程的,现在很苦恼,查了一两天都没查出来原类,用户那边正在抱怨着呢,领导要求最近一定要查出来,请大家帮忙看看是什么原因,多谢了:
我的数据库驱动程序是classes12.jar ,数据库连接用的是odbcracle:thin:@172.18.26.89:1521racl
驱动为oracle.jdbc.driver.OracleDriver
我换了classes14.jar,驱动racle.jdbc.OracleDriver,也报这个错
我将ora文件的process调成500个,还报这个错 [/B]
论坛徽章:9
在 hosts中记录你RAC节点的IP就可以了!
论坛徽章:1
楼上能说得更清楚点吗
楼上能说得更清楚点吗
论坛徽章:9
如果DB是unix/linux系统上,则把 /etc/hosts中的IP记录到客户端(一般是Windows)的C:\WINDOWS\system32\drivers\etc\hosts文件中,如果你没有使用DNS的话
如果DB是在Windows上,也是一样
招聘 : 论坛徽章:7
Subject:&&JDBC Connection Failure: Network Adapter Could not Establish Connection
&&Doc ID:&&Note: Type:&&PROBLEM
&&Last Revision Date:&&28-MAY-2007 Status:&&PUBLISHED
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
& &&jdbcracle:thin:@hostort:sid&
you would need to use a string of the form
& &&jdbcracle:thin:@(DESCRIPTION=&& && && && && && & +
& && && && && && && && & &(ADDRESS_LIST=&& && && && &&&+
& && && && && && && && && &&&&(ADDRESS=(PROTOCOL=TCP)& +
& && && && && && && && && && && && &&&&(HOST=host)&& & +
& && && && && && && && && && && && &&&&(PORT=port)&& & +
& && && && && && && && && &&&&quot&& && && && && && && &&&+
& && && && && && && && & &quot&& && && && && && && && && &+
& && && && && && && && & &(CONNECT_DATA=&& && && && &&&+
& && && && && && && && && &&&&(SERVICE_NAME=sid)&& && &+
& && && && && && && && && &&&&(SERVER=DEDICATED)&& && &+
& && && && && && && && & &quot&& && && && && && && && && &+
& && && && && && && &&&&quot&
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
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.
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.
In a Unix environment, the &host& command can be used&&to determine what
IP address a name will be resolved as for example:
& &has address 111.222.333.444
In a Unix environment, the &hostname& command can be used to display the
name of the machine as defined by the /etc/host file or by a DNS server,
for example:
$ hostname
If the IP address of the current host is not known then do /sbin/ifconfig to
display this information ( look for attribute label &inet addr&quot
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
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.&&So the solution in Unix
is to&&place the name on the /etc/hosts file as an ALIAS.&&
The /etc/hosts is made up of a line for each host&&in the form
IP_ADDRESS& & HOSTNAME& & ALIAS
& & & & $& lsnrctl stat
is issued.&&the entry after HOST= must match IP_ADDRESS HOSTSNAME ALIAS
in the /etc/hosts file.
论坛徽章:1
在数据导入,我也遇到了这样的问题。现在数据量大,导入一半时出现,以至于没办法完全导入数据。
找不到原因=。=
直接捕获异常解决。。。。
& &&&conn = DriverManager.getConnection(url, username, password);
} catch (SQLException ex) {
& &&&conn = DriverManager.getConnection(url, username, password);
论坛徽章:9
这些淫呐,问题解没解决也不反馈一下,想问的时候哭着喊着的问,解决了就一个屁都不放,也不给后来者点参考,BS之!!!
论坛徽章:0
Check your database server's TNS set up.
On your client talking to the db server, you need to be able to ping the
db server using the same hostname as that is in the TNS set up.
For example, the server TNS set up has -
&&(DESCRIPTION =
& & (ADDRESS = (PROTOCOL = TCP)(HOST = RAC1)(PORT = 6015))
& & (CONNECT_DATA =
& && &(SERVER = DEDICATED)
& && &(SERVICE_NAME = RACDB)
& && &(INSTANCE_NAME = RACDB1)
&&(DESCRIPTION =
& & (ADDRESS = (PROTOCOL = TCP)(HOST = RAC2)(PORT = 6015))
& & (CONNECT_DATA =
& && &(SERVER = DEDICATED)
& && &(SERVICE_NAME = RACDB)
& && &(INSTANCE_NAME = RACDB2)
&&(DESCRIPTION =
& & (ADDRESS = (PROTOCOL = TCP)(HOST = RAC1)(PORT = 6015))
& & (ADDRESS = (PROTOCOL = TCP)(HOST = RAC2)(PORT = 6015))
& & (LOAD_BALANCE = yes)
& & (CONNECT_DATA =
& && &(SERVER = DEDICATED)
& && &(SERVICE_NAME = RACDB)
& && &(FAILOVER_MODE =
& && &&&(TYPE = SELECT)
& && &&&(METHOD = BASIC)
& && &&&(RETRIES = 180)
& && &&&(DELAY = 5)
Then on your client side, you need to be able to ping RAC1 and RAC2.
If you can't ping and your client is linux or unix, you may get intermittent
connection from your JDBC Java application.
Hope it helps.
论坛徽章:1
这个问题我也遇到过,数据量突然增加,JDBC连接就会报出这个错误来,我一般的解决是把监听重新做一遍,我怀疑是不是JDBC和监听之间有bug啊。
itpub.net All Right Reserved. 北京皓辰网域网络信息技术有限公司版权所有    
 北京市公安局海淀分局网监中心备案编号: 广播电视节目制作经营许可证:编号(京)字第1149号

我要回帖

更多关于 network adapter驱动 的文章

 

随机推荐