I have been struggling all day to make a
JDBC connection to my Oracle database. Here is the connection code I have:
The error I get when I run this code is this:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
I've done extensive Googling on this, and people have suggested that if I am able to run the following telnet command from my command prompt then JDBC should work:
telnet localhost 1521
When I run that command, I get an error, so I think this is the heart of my problem (though I don't really understand it). This is the error message:
Could not open connection to the host, on port 1521: Connect failed
I've also seen online that I need to make sure that a listener is working, using the lsnrctl command. I believe that it is started. When I enter "status" in the lsnrctl prompt, I get this:
Connecting to <DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
-------------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.3.0 - Production
Start Date 01-APR-2011 22:21:20
Uptime 0 days 0 hr. 0 min. 28 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
Listener Log File C:\oracle\product\10.2.0\db_1\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(HOST=10.0.1.5)(PORT=1521)))
Services Summary...
Service "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
Please help. I am desperate to fix this issue but have not been able to figure out how to resolve my telnet problem all day long.