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

    ODP.NET for .net 3.5

      My database is oracle
      I tried using ODP.NET for 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
      Dim conn As New OracleConnection("Datasource=oracle;User ID=test;Password=testing123;")
      catch ex as OracleException
      if ex.number = 28001 then 'password expired
      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 client
      So i changed ODP.NET to 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())
      conn.ConnectionString = constr;
      catch (Exception ex)

      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()
      conn.ConnectionString = constr
      Catch ex As Exception
      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, 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.

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