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. Ping does not change the URL correctly.
The port number is correct.
To do this: type Sqlplus on DOS to check if Oracle is turned on
All normal then 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.
The 3rd step is still not possible.
3. The database listener does not start modifying the ImagePath value in the registry on your PC.
The following is an example of an Oracle database
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 caused by the database listener is not started.
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 (other versions correspond to the ORAXXX directory)/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, which is common in 3.
Original address: http://blog.csdn.net/mr_von/article/details/2880626