1

I have the version 9.1.131.0.

I want to connect to a Oracle 12 DB with a Service Name. I have the login, pw, server, but it seems i can't add a service name or port to OracleConnectionStringBuilder.

How do i connect to my db with a service name?

I can make it happen with Oracle.ManagedDataAccess but due to performance issues i want to test if the Devart Driver is working better.

kind regards

KaraKaplanKhan
  • 734
  • 1
  • 14
  • 31
k4yaman
  • 475
  • 8
  • 20
  • 1
    Most likely the performance does not change. Anyway, what is your connection string and what is the error you get? – Wernfried Domscheit Nov 08 '16 at 15:00
  • It says {"Keyword not supported: 'service name'."} ConnectionString is: $"User ID={myCSB.UserId}; Password={myCSB.Password}; Server={host}; Service Name={serviceName}; Port=1521;" – k4yaman Nov 08 '16 at 15:06
  • 1
    I don't know whether DevArt supports `Server, Service Name, Port`. Usually this is defined by alias in `tnsnames.ora` file. Try `Data Source` instead. – Wernfried Domscheit Nov 08 '16 at 15:09
  • Now it throws the exception when i open it: "Cannot obtain Oracle Client information from registry. Make sure that Oracle Client Software is installed and that the bitness of your application (x64) matches the bitness of your Oracle Client, or use the Direct mode of connecting to a server." – k4yaman Nov 08 '16 at 15:15
  • 1
    Did you check "that the bitness of your application (x64) matches the bitness of your Oracle Client"? Unlike DevArt `Oracle.ManagedDataAccess` is Independent from bitness of your application. – Wernfried Domscheit Nov 08 '16 at 15:17
  • Yes Ofc, everything is 64 bit. Well i actually have no Oracle Client installed at all and i don't want to, because is should work without the client – k4yaman Nov 08 '16 at 15:19

2 Answers2

1

Try SID instead of Service Name. I found this one: Using Direct Mode

SID** System identifier (Global Database Name)

** The Service Name connection string parameter can be used instead of SID, but in the Direct Mode you can connect only to one database instance (RAC isn't supported).

For me this works:

var str = new DbConnectionStringBuilder(false);
str.Add("Data Source", db);
str.Add("User ID", user);
str.Add("Password", pw);
var con = new Devart.Data.Oracle.OracleConnection(str.ConnectionString);
con.Open();

You can also put full connection string as data source instead of retrieving the alias from tnsnames.ora file, e.g.

string db = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={host})(PORT=1521))(CONNECT_DATA=(SERVICE_NAME={serviceName})))";
str.Add("Data Source", db);
Community
  • 1
  • 1
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • I found this too, but my class OracleConnectionStringBuilder doesn't have this method. IDK why – k4yaman Nov 08 '16 at 15:20
  • 1
    Use the generic class [DbConnectionStringBuilder](https://msdn.microsoft.com/en-us/library/system.data.common.dbconnectionstringbuilder(v=vs.110).aspx) – Wernfried Domscheit Nov 08 '16 at 15:30
0

So this is my conclusion:

Since I don't want my users to install the Oracle Client or a install package more than 10 MB, the Devart dotConnect Express for Oracle will not work.
Quote from exception:
"Express Edition doesn't support Direct mode. Do not use Direct parameter of connection string. Refer to dotConnect for Oracle editions matrix."

Thanks for the help.

Kind regards

k4yaman
  • 475
  • 8
  • 20
  • I don't know what your performance issues are, but when you check the big enumeration of limitations for Direct Mode you see several of them would certainly degrade your performance, e.g. no statement caching or missing support for array binding. – Wernfried Domscheit Nov 09 '16 at 10:50