By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,304 Members | 3,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,304 IT Pros & Developers. It's quick & easy.

What is the use of tnsnames.ora?

P: 8
I'm writing an application in ASP.NET using C# for code behind and i'm also using oracle 10g. I thought when i retrieve data from the DB first tnsnames.ora is referred. But my experience is that server name given in web.config is directly connected whether or not entry is present in tnsnames.ora. Then why do we need a tnsnames.ora?
Jun 14 '07 #1
Share this Question
Share on Google+
7 Replies


debasisdas
Expert 5K+
P: 8,127
It defines the application can connect to which database,server address using which port . its for reference of database.
The web.config file is for webpages not for the database.

a typical entry in tnsname.ora file is as follows.
----------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. OM =
  2.   (DESCRIPTION =
  3.     (ADDRESS = (PROTOCOL = TCP)(HOST = is-18)(PORT = 1521))
  4.     (CONNECT_DATA =
  5.       (SERVER = DEDICATED)
  6.       (SERVICE_NAME = Om)
  7.     )
  8.   )
  9.  
  10. EXTPROC_CONNECTION_DATA =
  11.   (DESCRIPTION =
  12.     (ADDRESS_LIST =
  13.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
  14.     )
  15.     (CONNECT_DATA =
  16.       (SID = PLSExtProc)
  17.       (PRESENTATION = RO)
  18.     )
  19.   )
  20.  
  21. MES =
  22.   (DESCRIPTION =
  23.     (ADDRESS_LIST =
  24.       (ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.15.3)(PORT = 1521))
  25.     )
  26.     (CONNECT_DATA =
  27.       (SID = MES)
  28.     )
  29.   )
  30.  
  31. BDCORA =
  32.   (DESCRIPTION =
  33.     (ADDRESS_LIST =
  34.       (ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.12.16)(PORT = 1521))
  35.     )
  36.     (CONNECT_DATA =
  37.       (SERVICE_NAME = orcl1)
  38.     )
  39.   )
  40.  
  41. MESTEST =
  42.   (DESCRIPTION =
  43.     (ADDRESS_LIST =
  44.       (ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.14.155)(PORT = 1521))
  45.     )
  46.     (CONNECT_DATA =
  47.       (SERVICE_NAME = MESTEST)
  48.     )
  49.   )
  50.  
Jun 14 '07 #2

P: 8
lrg
My application is connecting to a server which isn't entered in tnsnames.ora. Why is this happening?
Jun 14 '07 #3

debasisdas
Expert 5K+
P: 8,127
Is that defined in web.config ???
Jun 14 '07 #4

P: 8
lrg
Yes, server name is defined in web.config. But how is it possible to find out the correct server from the name alone? No ip address or port no or any other detail is given.
Jun 14 '07 #5

debasisdas
Expert 5K+
P: 8,127
You can use either IP address OR servername.

Because as there can't be more than one system with same IP address there can't be more than one system by the same in the same network.
Jun 14 '07 #6

P: 8
lrg
thanks a lot. now i'm clear.
Jun 14 '07 #7

debasisdas
Expert 5K+
P: 8,127
Hi
Irg
Welcome to TSDN.

You have reached the right place for knowledge shairing.

Here you will find a vast resource of related topics and code.

Feel free to post more doubts/questions in the forum.

But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

It will help Experts in the forum in solving/underestanding your problem in a better way.

Please follow the posting guidelines in every new post/reply.

please specify your post/question clearly.

Dont expect others to guess and solve your problem.

Regards

Debasis
Jun 14 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.