1

I have a program I am testing out and I want to view the code "under the hood", specifically the OpenWithNewPassword method (might have to Ctrl+F on the page). Is there something similar to Reference Source from Microsoft that Oracle provides? The only thing I can find is a definition of what the method is and what it does.

using System;
using Oracle.DataAccess.Client; 
 
class PasswordExpirationSample
{
  static void Main()
  {
    OracleConnection con = new OracleConnection();
 
    try
    {
      con.ConnectionString = 
        "User Id=testexpire;Password=testexpire;Data Source=oracle";
      con.Open();
      Console.WriteLine("Connected to Oracle" + con.ServerVersion);
    }
    catch (OracleException ex)
    {
      Console.WriteLine(ex.Message);
 
      //check the error number 
      //ORA-28001 : the password has expired
      if (ex.Number == 28001)
      {
        Console.WriteLine("\nChanging password to panther");
        con.OpenWithNewPassword("panther");  // What call is this making with the database?
        Console.WriteLine("Connected with new password.");
      }
    }
    finally
    {
      // Close and Dispose OracleConnection object
      con.Close();
      con.Dispose();
      Console.WriteLine("Disconnected");
    }
  }
}
user94614
  • 511
  • 3
  • 6
  • 26
  • 1
    this question reminds me that......(since oracle got java).......that has moved to more closure.......where as dot-net-core has moved to much more open and dot-net-core is much more like the original-java-promise than java is now. https://en.wikipedia.org/wiki/Write_once,_run_anywhere #holyWar I am curious to see if there is place to "see" the code. but i'm not holding my breath. – granadaCoder Aug 04 '20 at 13:48
  • Have you run a decompiler over it? Just curious – Caius Jard Aug 04 '20 at 13:50
  • One cheap trick I use.......is too internet search "public class MyThing" "using System" because most times, the source code will have that "using System" AND this weeds out the "just documentation" search-results. for example : "public class OracleException" "using System" will (eventually) get you to a google-cached version of the file here : (next comment) – granadaCoder Aug 04 '20 at 13:54
  • http://webcache.googleusercontent.com/search?q=cache:z_y668qXf0oJ:www.dotnetframework.org/default.aspx/Dotnetfx_Win7_3@5@1/Dotnetfx_Win7_3@5@1/3@5@1/DEVDIV/depot/DevDiv/releases/whidbey/NetFXspW7/ndp/fx/src/DataOracleClient/System/Data/OracleClient/OracleException@cs/1/OracleException@cs&hl=en&gl=us&strip=1&vwsrc=0 – granadaCoder Aug 04 '20 at 13:54
  • PS Oracle owns ODP.NET. Not Microsoft. ( https://www.nuget.org/packages/Oracle.ManagedDataAccess/ ) (find "OWNER" in the bottom right of the page) ........ The (old) Oracle Provider by Microsoft......has been pretty much abandoned and most say "don't use it". – granadaCoder Aug 04 '20 at 13:57
  • 2
    The java thing is interesting too; regardless the official line I always suspected that .net represented the salvation of the r&d MS put into creating their own flavour of java before Sun punched them on the nose. What better way to turn it around than take the wide reaching market appeal of "write one lang, run on any os" to create a similarly appealing "write any lang, run on one os" (as a way catching all the c,vb,foxpro etc lovers).. especially if the end goal was to make it "write any lang, run any os".. – Caius Jard Aug 04 '20 at 13:58
  • Re the decompiler thing, have you tried feeding the oracle dlls into eg ILSpy? – Caius Jard Aug 04 '20 at 14:00
  • @CaiusJard I haven't run a decompiler (though I'm fairly confident that will work) over it though that is where I should have probably started but the Reference Source is so handy I thought I throw this question out here first. – user94614 Aug 04 '20 at 14:08
  • @granadaCoder Interesting on the cached version, thanks. I'll what I can dig up but if it has never been published, I'll be out of luck – user94614 Aug 04 '20 at 14:10
  • Yee.. the problem you run into is that SO isn't a "where is the documentation for.." - questions that ask us to locate an external resource are off topic. You could only really ask something in relation to documentation and offsite resources that can be answered on a factual basis. Even then people might see the "request for documentation" bit and reach for the close-hammer anyway – Caius Jard Aug 04 '20 at 14:18
  • My spidey sense says "I think you'll be out of luck".. But if you find a needle, let us know! Good luck! – granadaCoder Aug 04 '20 at 14:18
  • @CaiusJard I hear you and I debated on opening it (plus I do see some close votes). I'd wager if someone did have an answer to this question, it would become a "Famous Question" fairly quick. – user94614 Aug 04 '20 at 14:26
  • @granadaCoder That's what I'm thinking but thanks for stopping by and your comments :-) – user94614 Aug 04 '20 at 14:27
  • The catch22 you have with running e.g. ILSpy on it is that [the license agreement](https://www.oracle.com/downloads/licenses/distribution-license.html) prohibits one to "cause or permit reverse engineering (unless required by law for interoperability), disassembly or decompilation of the Programs;", so to get the software onto your machine you need to agree to the license, which then seems to prevent you from looking at the source.. – Caius Jard Aug 04 '20 at 16:34
  • https://docs.oracle.com/en/database/oracle/oracle-database/12.2/odpnt/ConnectionOpenWithNewPassword.html#GUID-4CD612F3-319E-45DD-8211-0CA9B42F8AD0 – T.S. Aug 06 '20 at 19:57
  • I've looked into ODP code tons of times. jetBrains dotPeek – T.S. Aug 06 '20 at 19:58
  • @T.S. That was my backup plan, no big deal. I was just curious if Oracle put it out there for us. – user94614 Aug 06 '20 at 21:08

1 Answers1

0

I can only guess, for reasons mentioned in the comments

con.OpenWithNewPassword("panther");  // What call is this making with the database?

It probably takes the existing connection, with all its parsed connection string and any internal state etc, and changes just the password, then tries to open the connection again. The connection string contains a lot of stuff (user, password, host etc), that will be parsed and used internally throughout the life of the connection object. There might be a valid use case for not doing all that again, and just changing the password, and connecting to the db again. (I can't personally think of one, unless transactions survive across connection cycling; I'd just make a new connection with the new password)

At the very least, without falling foul of the license agreement, you could probably use the debugger locals window to look at your connection with its internal variable for storing the password (under the non-public members node, because the OracleConnection doesnt seem to have a public password property like it does the other stuff), get its hashcode or screenshot values etc then call OpenWithNewPassword and see if the password changes but all else remains the same as before the connection is opened.. That'd be a reasonable indication of what it does

Caius Jard
  • 72,509
  • 5
  • 49
  • 80