JDBC url for oracle RAC

Posted by Enrico Giurin Thu, 12 Apr 2007 01: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 ,  | 18 comments | no trackbacks

Comments

  1. Avatar Tel Aviv said 362 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 378 days later:

    Thanks Enrico , it is very helpful for me

  3. Avatar Sloey said 462 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 693 days later:

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

  6. Avatar Sachin said 818 days later:

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

  7. Avatar Kalidass said 1058 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 1126 days later:

    Gracias…

  9. Avatar Magno said 1342 days later:

    \o/ It’s incredible right!

  10. Avatar tooni said 1482 days later:

    I agree,all children, even those with suspected or known mitochondrial diseases, should receive the recommended vaccinations.Thanks for sharing this information Bali Property

  11. Avatar prateek Stylome said 1519 days later:

    Good ! The information stated here is very useful, thanks! Like to read more. Prateek Stylome

  12. Avatar nilanjana.neogi@innovions.com said 1520 days later:

    I read your blog,it was awesome as it helped me gain so much of information about your website, i would be desperate to see such kind of more interesting blog in the near future.Prateek Noida. Prateek Stylome Noida

  13. Avatar Prateek Stylome said 1520 days later:

    I gone through your blog it was very informative as it helped me to enhance ny knowledge to a great extent. looking forward for such kind of more blog in your website.Prateek Stylome

    prateek stylome

  14. Avatar Prateek Stylome Noida said 1520 days later:

    I was reading your blog, i really found it very interesting and would like to see more such kind blogs at your website at its sooner. Prateek Stylome Noida prateek stylome noida

  15. Avatar shiek said 1554 days later:

    This works.. Thanks

  16. Avatar jeff said 1591 days later:

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

  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.

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