Search code examples
asp.net-core.net-core.net-5oracle19codp.net-managed

Oracle.ManagedDataAccess.Core (3.21.41), Oracle Wallet with Proxy User has error ORA-01017: invalid username/password; logon denied


I have .net 5/6 application and due to compliance requirements, I am requested to use oracle wallet with proxy user (No password in connection string). To make it simple: New connection string is: Data Source=myproxy; User Id=/;

I have put following files in current working directory i.e. bin/debug/net5.0:

  1. tnsnames.ora

sample file data:

myproxy=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhostip)(PORT=myport))(CONNECT_DATA= (SERVICE_NAME =myservname)(SERVER=DEDICATED)))
  1. sqlnet.ora

sample file data

SQLNET.WALLET_OVERRIDE = TRUE
SSL_CLIENT_AUTHENTICATION = FALSE
SSL_VERSION = 0
WALLET_LOCATION =(SOURCE =(METHOD = FILE)(METHOD_DATA =(DIRECTORY=mydirectories\wallets)))

I have .net framework application that works perfectly fine with above files and wallets. But I cannot seem to get it to work with .Net Core application. I have even used OracleConfiguration.OnsWalletLocation but no luck at all.

Here is the sample error:

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-01017: invalid username/password; logon denied
   at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, OracleConnection connRefForCriteria, String affinityInstanceName, Boolean bForceMatch)
   at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, OracleConnection connRefForCriteria, String affinityInstanceName, Boolean bForceMatch)
   at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, OracleConnection connRefForCriteria)
   at Oracle.ManagedDataAccess.Client.OracleConnection.Open()

Solution

  • I was able to run oracle wallet with .net5 application. For me, there was nothing wrong at the application level but oracle wallet. Oracle wallet with proxy user does not work for me but I was able to run oracle wallet with a schema user and password.

    Apart from wallet creation, everything else is the same as in above question. Here are the wallet creation commands to give you an idea of what works and what doesn't.

    Wallet that works:

    1. Create wallet

    mkstore -wrl . -create

    1. Create Credentials

    mkstore -wrl . -createCredential myproxy mySchemaUserName mySchemaUserPassword

    Wallet that does not work:

    1. Create wallet

    mkstore -wrl . -create

    1. Create Credentials

    mkstore -wrl . -createCredential myproxy myProxyUserName[mySchemaUserName] myProxyUserPassword

    Make sure to have Oracle.ManagedDataAccess.Core nuget in your solution, tnsnames.ora and sqlnet.ora files in your bin/debug or bin/debug/net5.0 folder. Data inside tnsnames.ora and sqlnet.ora files should be as in above question.