Io exception: The Network Adapter could not establish the connection

Source: Internet
Author: User
Tags server port

Io exception: The Network Adapter could not establish the connection
The appearance of this anomaly is generally related to the database and your PC's settings

This anomaly appears in roughly the following ways:


1. IP error.
Error when setting URL, for example: Jdbc:oracle:thin:@192.168.0.36:1521:sharp
The database server is incorrect: Ping the server IP is correct. Incorrect, change the URL to the correct
Port number error: generally not error.
To do this: type Sqlplus on DOS to check if Oracle is turned on
One is normal, perform the 2nd step below.

2. Firewall
If a fire wall is installed on the machine, it may be caused by a server port number screen. After shutting down the firewall, try reconnecting.
Still not, take the 3rd step.

3. The database listener does not start modifying the ImagePath value in the registry on the PC.
I'm following the current mainstream database Oracle for example
Restart the database listener manually:
1: Start → run → input cmd→ into DOS command prompt interface
D:>lsnrctl
lsnrctl> status
Or
Lsnrctl> start
If it's similar to the information in the picture

Congratulations, your problem has been found, is the database listener did not start the cause.
Here's how to manually start a database:
Execute regedit at run to enter the registry to
Start → Run →regedit
Press the path below
Hkey_local_machine\system\currentcontrolset\services\oracleorahome90tnslistener
Find Oracleorahome90tnslistener (I'm using oracle9i other version of it should be Oracleorahomexxxtnslistener)

Once found, you will find that ImagePath key value does not exist, create it: (if there is, click to modify, the method is described below)
Right-click, pop-up menu select New Key (N) → string value (S)


Name it ImagePath
Select the ImagePath right-click and select Modify:

Enter your Oracle installation directory in the value \ora90 (the other is the oraxxx directory) \bin\tnslsnr

If Oracle 10G, the installation directory is F:\oracle\product\10.1.0\Db_2\BIN\tnslsnr

When you are sure, exit the registry:
Then type start in the DOS command
If the following screen appears, congratulations, the listener started successfully:

Shut down DOS, start your program to test, should return to normal.
These are the reasons why the Network Adapter could not establish the connection exception is common in 3.


Article Source: DIY Tribe (http://www.diybl.com/course/3_program/java/javashl/20071126/87790.html)

Exceptions are as follows:

Org.apache.commons.dbcp.SQLNestedException:Cannot Create Poolableconnectionfactory (Io exception: 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 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)

Main reasons:

1. There may be an error in the DataSource configuration of the Server.xml file.

(1). If you are using data from this computer, the local data source is partially configured as: Username= "pcisv62" password= "one" url= "jdbc:oracle:thin:@localhost:1521: Orcl
(2). If you are using data from a server, the data source is partially configured as: Username= "pcisv62" password= "one" url= "jdbc:oracle:thin:@dbserver:1521: Corev6 "

(DBServer is the name of the server, COREV6 is the SID of Oracle on the server)

2. There may be an error in Oracle's Tnsnames.ora file configuration.

Tnsnames.ora under the installation directory E:\oracle\ora92\network\admin for Oracle:
Local Configuration:
ORCL =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST =Host name) (PORT = 1521))
)
(Connect_data =
(SERVER = dedicated)
(service_name = ORCL)
)
)
or server configuration:
Corev6_dbserver =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = dbserver) (PORT = 1521))
)
(Connect_data =
(SID = COREV6)
(SERVER = dedicated)
)
)

Io exception: The Network Adapter could not establish the connection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.