• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

java.sql.SQLException: Io exception: Connection Refused

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What driver are you using??
 
Charles Hasegawa
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The url string should be in this format:
jdbc:oracle:<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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic