Skip to content

ODP.NET connection to Oracle 19 via Windows 2022 Server #436

Description

@simeonovz

Hello,

I am running the following C# code successfully from my laptop:

class Program { static void Main() { string connectionString = "User Id=xx;Password=xx;Data Source = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCPS)(HOST = xxx)(PORT = 2484))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xxx)))"; OracleConfiguration.SqlNetWalletOverride = true; OracleConfiguration.WalletLocation= "C:\\wallet"; OracleConfiguration.TraceLevel = 7; OracleConfiguration.TraceFileLocation = "C:\\LOGS"; try { using (var connection = new OracleConnection(connectionString)) { connection.Open(); Console.WriteLine("Connected successfully to TCPS!"); } } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); Console.WriteLine($"Stack Trace: {ex.StackTrace}"); } } }

However when attempting to run the same code on a Windows 2022 Server I am receiving the following error in the trace:

2025-01-17 11:16:09.194245 TID:5 (PRI) (EXT) OracleException.ctor()
2025-01-17 11:16:09.205487 TID:5 (PRI) (SVC) (ERR) (CID1) OracleException.HandleError() from OracleConnectionImpl.Connect()(txnid=n/a) OracleInternal.Network.NetworkException (0x80004005): ORA-50201: Oracle Communication: Failed to connect to server or failed to parse connect string
---> OracleInternal.Network.NetworkException (0x80004005): ORA-00542: SSL Handshake failed
https://docs.oracle.com/error-help/db/ora-00542/
---> System.Security.Authentication.AuthenticationException: Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'.
---> System.ComponentModel.Win32Exception (0x80090326): The message received was unexpected or badly formatted.
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at OracleInternal.Network.TcpsTransportAdapter.Negotiate(ConnectionOption conOption)
at OracleInternal.Network.TcpsTransportAdapter.Negotiate(ConnectionOption conOption)
at OracleInternal.Network.TcpsTransportAdapter.Renegotiate(ConnectionOption conOption)
at OracleInternal.Network.OracleCommunication.SendConnectPacketAndProcessResponse(AddressResolution addrRes, Boolean bAsync)
at OracleInternal.Network.OracleCommunication.ConnectViaCO(ConnectionOption connOption, AddressResolution addrRes, Boolean bAsync)
at OracleInternal.Network.OracleCommunication.DoConnect(String tnsDescriptor, Boolean bAsync)
at OracleInternal.Network.OracleCommunication.Connect(String tnsDescriptor, Boolean doNAHandshake, String IName, ConnectionOption CO, Boolean bAsync)
at OracleInternal.ServiceObjects.OracleConnectionImpl.Connect(ConnectionString cs, Boolean bOpenEndUserSession, OracleConnection connRefForCriteria, String instanceName, Boolean bAsync)
2025-01-17 11:16:09.205540 TID:5 (PRI) (EXT) (CID1) OracleException.HandleError() from OracleConnectionImpl.Connect()

I can verify that I can connect from the server using sqlplus and that there are no issues. Can anyone please point me in what I am missing?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions