JDBC url for oracle RAC

Posted by Enrico Giurin Wed, 11 Apr 2007 18:07:00 GMT

If you have to connect to oracle RAC (Real Application Cluster) using JDBC with thin driver, the classic url:
jdbc:oracle:thin:@<HOST>:1521:<SID>
doesn’t work and you get the error ORA – 12505.
Instead, you must use this url:
jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=host2) (PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service)))
If you have an oracle client, like toad, check the tsnames.ora for the correct values of SERVICE_NAME and host.

Posted in  | Tags ,  | 27 comments | no trackbacks

Comments

  1. Avatar Tel Aviv said 361 days later:

    I kept getting this error over and over. I was hoping that a simple copy paste will solve it, as I just got sooooo annoyed from trying to solve it in the last 2 hours… and praise the lord it worked :) Changing the URLs as u stated did the trick and the connection worked flawlessly.

    THANKS A LOT !

  2. Avatar feedogator said 377 days later:

    Thanks Enrico , it is very helpful for me

  3. Avatar Sloey said 461 days later:

    Unfortunately for me even this didn’t work. I’m using a WebSphere 5 server with connection pools on a system with a 9i client connecting to a 10g RAC. When the client didn’t work I tried using jdbc as above, however I still get : Connection not available while invoking method queueRequest for resource jdbc/racserver. I can test the connection successfully but can’t create a pooled connection. J2CA0020E: The Connection Pool Manager could not allocate a Managed Connection: com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException

  4. Avatar Tú Phạm said 651 days later:

    Thanks alot, this artical help me much

  5. Avatar pmadrid said 692 days later:

    Use this url: jdbc:oracle:thin:@host1^host2:1521:service_name

  6. Avatar Sachin said 817 days later:

    Thanks a lot for the posting.. It helped us to get through

  7. Avatar Kalidass said 1057 days later:

    Some oracle forum posts seems to suggest that there is some issue with DB, but this post really helped.

  8. Avatar Kristyan said 1125 days later:

    Gracias…

  9. Avatar Magno said 1341 days later:

    \o/ It’s incredible right!

  10. Avatar gift basket ideas said 1498 days later:

    I still don’t understand what does that really mean.

  11. Avatar ranches for sale said 1528 days later:

    i used to visit your blog and found very in teresting posts on it.best of of luck for your so that you provide us with beautiful comment.

  12. Avatar ranches for sale said 1528 days later:

    i found very awesome comment on your blog so i wish you should come up with more such beautiful comment.

  13. Avatar avinash said 1538 days later:

    thank you.it helped me.

  14. Avatar shiek said 1553 days later:

    This works.. Thanks

  15. Avatar jeff said 1590 days later:

    thanks a lot…though the rac url looks nasty, i guess thatz the way to go….good job :)

  16. Avatar filter elements said 1630 days later:

    the blog post is really the freshest on this noteworthy theme. I harmonize with your conclusions and will thirstily look forward to hear your coming updates. I will tell you something about useful Welded wire mesh,wire meshes and so on.

  17. Avatar vasant_kumbhar@yahoo.com said 1687 days later:

    jdbc:oracle:thin:@:1521:

    in the above URL ’@’ stands for what ????

  18. Avatar sriram said 1715 days later:

    Thanks so much. It helped me to fix an issue.

  19. Avatar Jordan 5 said 1920 days later:

    big time is coming up… your wedding day event, a good anxiously anticipated day, a wedding anniversary or an important enterprise meeting. How do you pick a restaurant within Phoenix arizona that will blow the attendance party aside?Here I present you with Your five VERY required elements to thinking about just before booking a reservation at a restaurant inside Phoenix.Area. Remember that if you ?will need to push afterwards, and also you be prepared to have a great time, in particular during the night, you are best deciding on a restaurant within Phoenix, az that is close by, whether a place where you might walk back or even grab a pickup’s cab with ease.

  20. Avatar Chow said 1994 days later:

    Awesome…It works..We’ve struggled for long time to resolve issues with RAC DB and JDBC connectivity.

    Thanks so much

  21. Avatar baohuim said 2101 days later:

    thanks so much ,it works fine for me

  22. Avatar Ofelia said 2202 days later:

    In 1924 Phillip Morris introduces Marlboro as a womans cigarettes with the slogan “Mild as May”. Just as you find cigarette brands staring you in the face from the shelves in the store.

    The Blue label e-cig is a vital part of the Fifty One duo kits section. As of May 2010, a total of 168 countries have ratified the FCTC.

  23. Avatar lidl said 2273 days later:

    谢谢,这个解决了我的问题,真棒!

  24. Avatar sink said 2695 days later:

    Thanks for share this code, i hope its useful. setmotor

  25. Avatar 2015topwatches said 2947 days later:

    Just as you find cigarette brands staring

  26. Avatar woman shoes said 2967 days later:

    when you have to attend a lot of parties, you now don’t have to wear the same pair of sandals or shoes just because recession holds you back. Now you can have multiple pars of designer shoes that will absolutely adorn your feet.

  27. Avatar www.skyteamtrade.com said 3111 days later:

    consistently in the seek of new abstracts and innovations to accomplish the superior of their handbags even better.

Trackbacks

Use the following link to trackback from your own site:
http://www.jugpadova.it/articles/trackback/28454

(leave url/email »)

   Comment Markup Help Preview comment