1

Currenlty I am using the following connection string to connect to oracle database

string Source = new OracleConnectionStringBuilder()
    {
        DataSource = @"(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = YOURHOST)(PORT = 1521)))(CONNECT_DATA =(SID  = TESTORACLE)))",
    }.ConnectionString;
private IDbConnection databasecon= new OracleConnection(Source);

I have no idea how to specify that connect using os authentication

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
delwasaf ewrew
  • 557
  • 1
  • 8
  • 21
  • 1
    Does https://docs.oracle.com/cd/B28359_01/win.111/b28375/featConnecting.htm help? – mjwills Nov 28 '17 at 01:02
  • you will still need to have TNS names file but you could install the .NET oracle dataclient and create connection string similar to how it's done for sql server. do not use the 64bit .net oracle data client.. doesn't work.. also if you use the 32bit client you have to set the project to compile for x86 vs AnyCPU I use this one Oracle projects currently. you need to goto Oracle official site to register then download the correct OracleDataClient – MethodMan Nov 28 '17 at 05:26
  • @MethodMan, your comment is not related to question. Of course one can use the 64bit driver - you just have to install the 64bit client and compile for "x64" or "AnyCPU". A `tnsnames.ora` file is not required when you put full connection name instead of an alias. – Wernfried Domscheit Nov 28 '17 at 07:58
  • @WernfriedDomscheit for Oracle Data Client 64bit version has known issues ..read up on it.. – MethodMan Nov 28 '17 at 14:02
  • @MethodMan, do you have any reference for those issues? I am not aware of any. – Wernfried Domscheit Nov 28 '17 at 14:08
  • I have worked with converting Oracle forms qpp into C# for past 2 years have completed it and how else do you think that I would know this ..I have downloaded the 64bit .net and 32bit from Oracles official site.. and once again .. there is an issue with the 64bit version I have just tested once again changing my from x86 to AnyCPU does not recognize connection string that does not configure TNS .. if you work with Oracle and do not setup a connection string as the OP did.. then you will know what I am talking about – MethodMan Nov 28 '17 at 14:28
  • @MethodMan, perhaps you just made wrong installation of the 64bit Oracle Client, see https://stackoverflow.com/questions/24104210/badimageformatexception-this-will-occur-when-running-in-64-bit-mode-with-the-32#24120100. I am only aware of an issue when you use ODP.NET Managed driver when you use LDAP name server, see https://stackoverflow.com/questions/30905910/odp-net-managed-library-does-resolve-alias-but-32-bit-library-does/30920849#30920849 I am using 64bit Oracle Client in my application for years. – Wernfried Domscheit Nov 28 '17 at 15:25
  • nope, didn't make wrong installation, anyway.. the op can search for this themselves and see – MethodMan Nov 28 '17 at 16:03

1 Answers1

2

Finally found the way to create Non TNS windows authentication connection stringstring Source = new OracleConnectionStringBuilder() { DataSource = @"(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = YOURHOST)(PORT = 1521)))(CONNECT_DATA =(SID = TESTORACLE)))", UserID = @"/", }.ConnectionString; private IDbConnection databasecon= new OracleConnection(Source);

without user id and password just use UserID = @"/" for windows authentication

delwasaf ewrew
  • 557
  • 1
  • 8
  • 21