Io exception: The Network Adapter could not establish the connection solution

1. IP error: Error when setting URL, for example: jdbc:oracle:thin:@192.168.1.80:1521:orcl database server is correct: ping server IP is unobstructed. If the ping fails, change the URL to the correct one. Is the port number correct. Do some operations: type sqlplus on DOS, check whether oracle is enabled and everything is normal, then execute the second step below. 2. Firewall If a firewall is installed on the machine, it may be caused by the shielding of the server port number. Turn off anti...

1. IP error:
Error when setting the URL, for example: jdbc:oracle:thin:@192.168.1.80:1521: Whether the orcl
database server is correct: Whether the IP of the ping server is smooth. If the ping fails, change the URL to the correct one.
Is the port number correct.
Do some operations: type sqlplus on DOS, check whether oracle is enabled,
and if everything is normal, execute the second step below.

2. Firewall
If there is a firewall installed on the machine, it may be caused by the shielding of the server port number. After turning off the firewall, try to reconnect.
If still not working, go to step 3.

3. The database listener is not started to modify the ImagePath value in the registry on the PC.
Let’s take the ORACLE database as an example
to restart the database monitor manually:
1: Start → Run → Enter CMD → Enter the DOS command prompt interface
d:>lsnrctl
LSNRCTL> status
or
LSNRCTL> start
if it is similar to the information in the picture
 




Congratulations, your problem has been found out, which is caused by the database listener not being started.
The following is the method to manually start the database:
Execute regedit at the running place to enter the registry to
start → run → regedit
and press the following path
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/OracleOraHome90TNSListener
to find OracleOraHome90TNSListener (I use Oracle9i, other versions should be OracleOraHomexxxTNSListener)


 



After you find it, you will find that the key value of ImagePath does not exist. Create it: (If it exists, click Modify. The modification method is described below) Right-click and
select New Key (N)→String Value (S) from the pop-up menu
 



Name it ImagePath,
select ImagePath, right-click, and select Modify:

 



Enter your Oracle installation directory /ora90 (other versions correspond to the oraxxx directory)/bin/tnslsnr in the value

 



Exit the registry after confirming:
Then type start under the DOS command
and if the following screen appears, congratulations, the monitor has started successfully:


 


Close DOS, start your program to test, it should be back to normal.

The above are the common reasons for causing The Network Adapter could not establish the connection exception in 3.

Guess you like

Origin blog.csdn.net/unbelievevc/article/details/132487590