Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Tip: ODP.NET does not require tnsnames.ora

Alex Keh-OracleDec 5 2003 — edited Jun 7 2006
Here's a tip. You want to deploy ODP.NET as a client application, but you don't want to deploy Oracle's tnsnames.ora file.

The tnsnames.ora file allows you to define alias names to your DB servers. Instead, you would rather not use an alias and define the DB connection information within the .NET connecting string. You can do this with ODP.NET. For example, you can use the following connection string from C#:

string constr =
"User Id=scott;
Password=tiger;
Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = xxxx)(PORT = 1521)) )(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xxxx)));";

Just put in the your HOST and SERVICE_NAME information in the data source, create a connection object, and you are done! You can change or add any other connection string information to configure your Oracle connection.

Alex
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 5 2006
Added on Dec 5 2003
9 comments
10,710 views