• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

connect to oracle without hardcoding IP address

 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For connecting to Oracle using the SQL*Plus terminal, Oracle's tnsnames.ora file lets you specify multiple IP addresses that you can connect to (in case one of the machines hosting the database is down--yes, we're setting up a grid in Oracle 10g). However, in our Java web app, we're using the pure Java thin client driver and the only thing I know how to do in the connection string is specify the IP address or host name for one machine. How can we tell it something more generic so that it will know where the whole grid is? If we can't tell it something like that, then a given application server (running Tomcat) will be hardcoded to one database machine, so if that machine goes down, we'd have to restart Tomcat on that server after making the change in the eonnection string in our config file.
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you'll likely be using a connection pool for that, have you checked if your pool is capable of doing that?
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have an existing web app that's backed by a database that we're moving away from. We're going to Oracle so we can set up the grid...our connection pooling code does not handle that. Do we have to add a bunch of custom logic there? So there's no way to specify some sort of Oracle service name that we can connect to, or a way to tell the thin client a list of machines that it can connect to? I guess the connection pooling does make that trickier than what SQL*Plus has to worry about...
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found this in Doc ID #213412.1 on metalink.oracle.com:



That's how you would specify the locations of two different database servers for failover. BEA has an article on doing it with Weblogic and Oracle:
http://e-docs.bea.com/wls/docs81/jdbc/oracle_rac.html

[edited to add line breaks and disable smilies]
[ December 29, 2004: Message edited by: Jeanne Boyarsky ]
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks just like a TNS entry, which makes sense. When we moved to Oracle RAC, the one doing the setup used a MultiPool in WebLogic as per some documentation he read. Now we're moving to Tomcat, so I guess I'll be hitting that shortly. Thanks for following up with the solution!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic