• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Can't connect to Oracle database

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I am having a bit of a problem making a simple database connection. Here is my code:


My original problem was �class not found�, but I moved my ojdbc14.jar file into my apache/tomcat5.5/shared/lib directory. Now I�m getting a �connection refused� error, but I can successfully use the same password and username when logging in through SQL Plus.

Does this have something to do with my tnsnames.ora file?

Did I put the ojdbc14.jar file in the right directory?


-Thanks
[ March 08, 2005: Message edited by: Chris Staten ]
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, my question as to whether or not the tomcat/shared/lib directory is the right place to put the ojdbc14.jar file has been answered here.

I'll move the .jar file. Now I just need to know why my connection is being refused .
[ March 08, 2005: Message edited by: Chris Staten ]
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you double checked the database URL that you are using? In your code, this is the only place it can go wrong I guess.
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was in my URL. The URL for the thin driver has a couple of different formats, but the one I'm using is:

*remove the "-" infront of "oracle" and "PORT" in the URL, I was just trying to remove the emotes.

My service name in the URL above was SERVICE.WORLD. This is also how it looked in my tnsnames.ora file. However, I didn't need the .WORLD portion of the SERVICE_NAME. I made the adjustment by changing SERVICE.WORLD to SERVICE (e.g. TESTDATABASE.WORLD became TESTDATABASE) and it now works.

[ March 08, 2005: Message edited by: Chris Staten ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic