user897237
user897237

Reputation: 621

Accessing oracle database from c# with odb.net

I'm trying to access Oracle 11g DB. According to connectionstring.com , the connstring should be :

Driver={Oracle in OraClient11g_home1};Dbq=myTNSServiceName;Uid=user;Pwd=passwd;

Anyhow I'm getting an ArgumentException: 'Driver' is not a valid word.

Thank you.

Greetings

R. Bada

Upvotes: 1

Views: 956

Answers (1)

tpeczek
tpeczek

Reputation: 24125

It looks like you are trying to use connection string which is suitable in case of ODBC drivers for Oracle.

You should look for connection string suitable for ODP.NET in Oracle Data Provider for .NET / ODP.NET section. The best is to use one of the following:

Data Source=TNSServiceName;User Id=user;Password=passwd;

or

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=user;Password=passwd;

The first is suitable when you are using TNS, the second allows you to provide the service definition in connection string.

Upvotes: 3

Related Questions