Use odp.net to connect to Oracle DB using .NET framework 2.0/3.5
730303Oct 26 2009 — edited Oct 27 2009Hello,
I am using Oracle Data Access Components (ODAC) Beta (from http://www.oracle.com/technology/software/tech/windows/odpnet/install1110710beta.html)
to connect to my oracle DB through ASP.NET.My .NET enviornment on prod can be 2.0 or 3.5
My Oracle DB is Oracle 10.2 g (This installs OraClient11g Client on my Program files)
I have a lot of questions regarding this:
1: Am I using the correct odp.net provider?or should I use some other version.Please provide the link if any other version is a better one.
2: Do I need to have an Oracle 10 g client installed to use odp.net or just installing the ODAc work fine?
3:On my dev box,I just have the ODAC and no Oracle client (hence no tnsnames.ora file on my dev box) and I am able to connect to the DB using the following connection string:
Conn string:
Data Source=(DESCRIPTION="
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<IP Address>)(PORT=1526)))"
+ "(CONNECT_DATA=(SID = dbname)(GLOBAL_NAME = dbname.WORLD)));"
+ "User Id=uid;Password=pwd;
On production , is it a good practice to pass the tns entry in code using the connection string format as above?or should I install the 10 g client, configure the tns entry, and pass just the UID, password and the database value using code?
3: On the connection string or tns entry, for the parameter HOST, if I pass the machine name (e.g. HOST=abcdefg4sg10), I am getting the following error message:
ORA-12545: Connect failed because target host or object does not exist
However, If I I pass the IP address of the machine (e.g. HOST=10.xxx.xx.xxx), then it is getting connected.
Please let me know the issue.I should not use the iP address as the DB are in cluster.
4; My last question is on the PORT.When installing the OADC the installation wizard asks for the port.I understand that the default port is 1521.But if I install using port 1521 and pass some other value for PORT parameter on the connection string, e.g. PORT = 1526, stilll it gets connected.
I wanted to understand the use of the PORT.
Please clarify my doubts.
Regards.