Io 异常: The Network Adapter could not establish the connection(转)

Io anomaly: The Network Adapter could not establish the connection
of this unusual and generally set the database related to your PC

This anomaly appears generally have the following categories:


1. IP error.
When you set the wrong URL, for example: jdbc: oracle: thin: @ 192.168.0.36: 1521: sharp
database server is incorrect: ping server IP is correct. Incorrect, change the URL to the correct
port number error: error generally not.
Be it: Type sqlplus on DOS, check oracle whether to open
a normal but, perform the following step 2.

2. Firewall
If there are firewalls installed on your machine, the server port number may be shielded caused. After closing the firewall, try to reconnect.
Still does not work, step 3.

3. Database Listener ImagePath value on the registry to modify the PC does not start.
Below I now mainstream ORACLE database, for example
manually restart the database listener:
1: Start → Run enter CMD → → enter the DOS command prompt interface
d:> lsnrctl
LSNRCTL> Status
or
LSNRCTL> start
information if it is a similar picture

 

Congratulations, you have to find out the problem, the database listener did not start caused.
Here's how to manually start the database:
execute regedit into the registry to run at
Start → Run → regedit
in the following path
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ OracleOraHome90TNSListener
find OracleOraHome90TNSListener (I use other versions of Oracle9i should be OracleOraHomexxxTNSListener)

 

 

 

 After you find you will find ImagePath key value does not exist, create it :( exists, click Edit, modify the methods are documented below)
, right-click, pop-up menu to select a new key (N) → string value (S)

 
Will be named ImagePath
selected ImagePath right click, select the Modify:

Enter your Oracle installation directory \ ora90 in value (this corresponds oraxxx other directory) \ bin \ tnslsnr

If ORACLE 10G installation directory F: \ oracle \ product \ 10.1.0 \ Db_2 \ BIN \ tnslsnr

 

 

OK to exit the Registry after:
and then start typing in the DOS command
If the following screen appears, congratulations to you, the listener starts successfully:

 

Close DOS, start your testing program should be back to normal.
These are common in the Cause 3 The Network Adapter could not establish the connection anomaly

 


文章出处:DIY部落(http://www.diybl.com/course/3_program/java/javashl/20071126/87790.html)

 

 

 

异常如下:

org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
  at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
  at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
 
Caused by: java.sql.SQLException: Io 异常: 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)
 

主要原因:

1.可能是server.xml文件的DataSource配置出错。

(1).如果用到的是本机上的数据,本地数据源里的部分配置为: username="pcisv62" password="11" url="jdbc:oracle:thin:@localhost:1521:orcl"
(2).如果用到的是服务器上的数据,则数据源里的部分配置为: username="pcisv62" password="11" url="jdbc:oracle:thin:@dbserver:1521:corev6"

(dbserver为服务器的名字,corev6为服务器上Oracle的SID)

2.可能是oracle的tnsnames.ora文件配置出错。

oracle的安装目录E:\oracle\ora92\network\admin下的tnsnames.ora:
本地配置:
ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 主机名)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL)
    )
  )
或服务器配置:
COREV6_DBSERVER =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = COREV6)
      (SERVER = DEDICATED)
    )
  )

Guess you like

Origin www.cnblogs.com/cgy-home/p/11307130.html