This article explains the “Vendor code 17002” error in SQL Developer and how to fix it in Windows operating system. The error most likely happens because the listener is not running or has an incorrect configuration. To connect to the Oracle database, SQL Developer needs a listener running and configured correctly.
The listener is a service that handles connections for the databases. We might encounter the following error like in Figure 1 when we try to connect to Oracle from SQL Developer but not from SQL Plus. It is because, by default, the SQL Plus does not need the listener to connect to the database.
Figure 1. IO Error: The Network Adapter could not establish the connection
How to fix the Oracle Vendor code 17002 error
Suppose we have Oracle 18c Express Edition installed in our local machine and we encounter the 17002 error when connecting to the database using Oracle SQL Developer tool. To resolve the error, let’s do these steps below to make sure that the listener is running and has the correct configuration.
Step #1. Make sure the listener is running
We can check the status of the listener from the Windows Service Manager or the Command Prompt.
Check the listener status from the Windows Service Manager.
1. Open the Run dialog by pressing Win+R shortcut.
2. Type services.msc, then press Enter or click OK.
Figure 2. Windows Run dialog.
3. Make sure that the TNS listener service is running. If not, right-click on the service name and select Start.
Figure 3. Start the TNS listener service.
Check the listener status from Command Prompt.
1. Run the Command Prompt as administrator.
2. Type the following command to check the listener status.
3. Pay attention to the result. If there is an error similar to the following screenshot, most likely that the listener is down. If so, we need to start the service.
Figure 4. TNS-12541: TNS:no listener.
4. If the service is not running, start it by typing the following command:
Step #2. Make sure the listener has the correct configuration
1. On the database name, right-click and select Properties.
Figure 5. Open Database Connection window.
2. A window similar to the below screenshot will appear. Pay attention to the hostname and port values in the Details tab.
Figure 6. Database Connection window.
Note: We need to make sure that the hostname and the port number in this connection window are correct. The default port is 1521, but 1522 is also common.
3. Let’s check our computer’s hostname by typing the following line in Command Prompt.
Figure 7. Find hostname using the Command Prompt.
As we can see in Figure 4 above, the hostname is EVE, and it’s different than the hostname value in our connection window in Figure 6, which is DESKTOP-DIFJ0S3. This difference can happen because we changed our computer name. In this case, we need to correct the hostname in the connection window.
Note: We can also see the hostname using other ways, such as from Control Panel > System and Security > System.
4. Open listener.ora file using any text editor. The file is located in %ORACLE_HOME%/network/admin/listener.ora.
Figure 8. Listener.ora file.
In this case, we need to change the HOST value from DESKTOP-DIFJ0S3 to EVE. We also need to ensure that the PORT value is 1521.
5. Open tnsnames.ora file and ensure the configuration of hostname and port number are correct. The path is in %ORACLE_HOME%/network/admin/tnsnames.ora.
6. Open Windows Service Manager and restart the OracleServiceXE service by right-clicking on the service name and select Restart. We need to do this as we made modifications to listener.ora and tnsnames.ora in Step 4 and Step 5.
Figure 9. Restart OracleServiceXE.
7. Open the connection window again and test the connection with the right setting. After ensuring the values are correct for hostname, port, and other fields such as username and password, click the Test button. If the connection is successful, the status will change to “Success” like in the following screenshot.
Figure 10. Sample successful test connection.
8. Click the Connect button. After connected, we will be able to browse and query the database.
Figure 11. Sample successful connection.