• 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

How to make Database Connection reading the 'tnsnames.ora' file ?

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Can anybody tell me the standard way to read the tnsnames.ora file and connect to database automatically.
I have the name of the service(i.e TEST from below entry in tns file) , Username and Password.

a samle entry in tnsnames.ora:-


So now I have only the name TEST and I have to connect this DB after reading its host IP(10.5.3.1) and port address(1521).

Please help with code.

Thanks,
Kousik

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will need the user name and password
Just the previous post had the details
Connect to Oracle

Intuitively thinking, what all do you need to , say, login to your email?
You need the correct URL, you need user name and password, right?

Jhakda

 
Kousik Majumder
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to know that how could I find the host IP address and PORT number from the tnsnames.ora file after reading that file.
Is there any standard way to find that?

I have the service name(TEST for above example given) only to find the corresponding host IP address and PORT number from the tnsnames.ora file.

Note: I have username and password. Dont bother about that.

Thank you,

Kousik
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you really specifically need the IP address and port number for something else than connecting to the database?

If you want to connect to an Oracle database and you only know the TNS alias as listed in tnsnames.ora, then have a look at this page, especially "3.2.1.2 TNSNames Alias Syntax" on the bottom. It shows you how to connect to an Oracle database if you only know the TNS alias.
 
Does this tiny ad smell okay to you?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic