Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: Io exception: Connection Refused

 
Charles Hasegawa
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Updated)

Ok, here's the deal. I am on a Windows 2000 machine running Oracle 9i.
I can run SQLPlus and connect to the DB just fine using this entry from the tnsnames.ora:

FOO.NAMES.CHANGED.TO.PROTECT.THE.INNOCENT.US =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = my-computer.NAMES.CHANGED.TO.PROTECT.THE.INNOCENT.US)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = someservice.name)
)
)

When I use the above connection information in my JDBC, I get the dreaded java.sql.SQLException: Io exception: Connection Refused. There is indeed a '-' character in the name of the host, which is why I've included it in the above modified example. Again, no problems connecting using SQLPLus.

Anyone have any ideas?
[ February 28, 2005: Message edited by: Charles Hasegawa ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What driver are you using??
 
Charles Hasegawa
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oracle thin drivers.

Update:

In the code, I am just doing this:


I have changed the connection string to:



I can without issues, but the second I try to my code, I now get a java.sql.SQLException: Io exception: Connection Refused (different than the original post)

This works fine on my dev system, but the production database machine refuses to work with me.
[ February 28, 2005: Message edited by: Charles Hasegawa ]
 
Pete Tibbster
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The url string should be in this format:
jdbcracle:<drivertype>:@<db server>:<db port>:<instance>

from your original post with your tnsnames settings, i'm reading that your oracle instance is someservice.name

Therefore, shouldn't you be using this...... (no foo at the end)


Also, maybe the hostname lookup isn't working as you expect from your code. Do you get a different result if you swap the hostname for the actual IP address?
[ February 28, 2005: Message edited by: Pete Tibbster ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic