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?
What is the use of tnsnames.ora?
Collapse
X
-
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.
----------------------------------------------------------------------
[CODE=oracle]
OM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = is-18)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = Om)
)
)
EXTPROC_CONNECT ION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
MES =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.15.3)(POR T = 1521))
)
(CONNECT_DATA =
(SID = MES)
)
)
BDCORA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.12.16)(PO RT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl1)
)
)
MESTEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.14.155)(P ORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = MESTEST)
)
)
[/CODE] -
-
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.Comment
-
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
DebasisComment
Comment