3 Replies Latest reply on May 8, 2013 1:30 AM by 1007423

    ODP.NET for .net 3.5

    1007423
      Hi,
      My database is oracle 11.2.0.2
      I tried using ODP.NET for 11.2.0.3 to change password upon expiry but i got this error when trying to change password: ORA-1017: invalid username/password; logon denied
      So I cannot change password/login at all from ODP.NET.
      Any idea how to solve this?
      My code for 11.2.0.3:
      Dim conn As New OracleConnection("Datasource=oracle;User ID=test;Password=testing123;")
      try
      conn.open()
      catch ex as OracleException
      if ex.number = 28001 then 'password expired
      try
      conn.openwithnewpassword("wonderful123")
      catch ex2 as exception
      console.writeline(ex2.message) 'this will give ORA-1017: invalid username/password; logon denied
      end try
      end if
      end try

      I saw some websites said that i need to use 11.2.0.2 client
      So i changed ODP.NET to 11.2.0.2 however when i just try to connect it gave me error with no error message in VB :S
      There's error message though in C# :S
      This is very weird...
      Can someone please help me??

      C# code to just connect will give correct OracleException {"ORA-28001: the password has expired"}
      string constr = "User Id=test; Password=testing123; Data Source=oracle;";
      string ProviderName = "Oracle.DataAccess.Client";

      DbProviderFactory factory = DbProviderFactories.GetFactory(ProviderName);

      using (DbConnection conn = factory.CreateConnection())
      {
      try
      {
      conn.ConnectionString = constr;
      conn.Open();
      }
      catch (Exception ex)
      {
      Console.WriteLine(ex.Message);
      Console.WriteLine(ex.StackTrace);
      }
      }

      But the same VB code... gives no error message for OracleException -> Oracle.DataAccess.Client.OracleException: {""}

      Sub main()
      Dim constr As String = "User Id=test; Password=testing123; Data Source=oracle;"
      Dim ProviderName As String = "Oracle.DataAccess.Client"
      Dim factory As DbProviderFactory = DbProviderFactories.GetFactory(ProviderName)
      Using conn As DbConnection = factory.CreateConnection()
      Try
      conn.ConnectionString = constr
      conn.Open()
      conn.Close()
      Catch ex As Exception
      Console.WriteLine()
      End Try
      End Using
      End Sub

      Did I miss anything????
      Can someone help please... what to do???

      Also how come I cannot directly use New OracleConnection for 11.2.0.2, is it meant to be like that?
      Because when i tried using New OracleConnection without using dbproviderfactory, it gave me Object reference not set to an instance of an object. error at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) at Oracle.DataAccess.Client.OracleConnection.Open()

      How to fix the first error?
      Basically my main objective is to be able to change the password upon expiry.
      Thanks!

      Edited by: user2663005 on May 7, 2013 11:12 AM