title: AWS Oracle with SSL java.sql.SQLRecoverableException: IO Error: Connection reset AWS
body: <p>I am trying to connect a simple java application to an AWS Oracle DB using the SSL connection with protocle=tcps
  I have verified below
  I have imported the rds-ca-2019.pem and rds-ca-2015.pem file to my trust store and the ssl handshake seems to be fine. I have used the below as outlined in AWS Doc</p>
  
  <pre><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  import java.util.Properties;
  
  public class OracleSslConnectionTest {
      private static final String DB_SERVER_NAME = "&lt;dns-name-provided-by-amazon-rds&gt;";
      private static final Integer SSL_PORT = "&lt;ssl-option-port-configured-in-option-group&gt;";
      private static final String DB_SID = "&lt;oracle-sid&gt;";
      private static final String DB_USER = "&lt;user name&gt;";
      private static final String DB_PASSWORD = "&lt;password&gt;";
      // This key store has only the prod root ca.
      private static final String KEY_STORE_FILE_PATH = "&lt;file-path-to-keystore&gt;";
      private static final String KEY_STORE_PASS = "&lt;keystore-password&gt;";
  
      public static void main(String[] args) throws SQLException {
          final Properties properties = new Properties();
          final String connectionString = String.format(
                  "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=%s)(PORT=%d))(CONNECT_DATA=(SID=%s)))",
                  DB_SERVER_NAME, SSL_PORT, DB_SID);
          properties.put("user", DB_USER);
          properties.put("password", DB_PASSWORD);
          properties.put("oracle.jdbc.J2EE13Compliant", "true");
          properties.put("javax.net.ssl.trustStore", KEY_STORE_FILE_PATH);
          properties.put("javax.net.ssl.trustStoreType", "JKS");
          properties.put("javax.net.ssl.trustStorePassword", KEY_STORE_PASS);
          final Connection connection = DriverManager.getConnection(connectionString, properties);
          // If no exception, that means handshake has passed, and an SSL connection can be opened
      }
  }
  </code></pre>
  
  <p>Confirming that I have opened an inbound rule to the instance from teh security group of the Oracle RDS 
  I have used many ojdbc drivers 
   ojdbc14.jar
   ojdbc6.jar
  ojdbc8-12.2.0.1.jar</p>
  
  <p>Confirming that I can access the DB without ssl , which mean protocol=tcp and with the designated port for non -ssl </p>
  
  <p>It is when I used the below I get the error 
  With protocol=tcps
  port=ssl port 
  Confirming the trust store path and the password are okay 
  Need help in the below error </p>
  
  <pre><code>java.sql.SQLRecoverableException: IO Error: Connection reset
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:682)
      at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:711)
      at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:385)
      at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:558)
      at java.sql.DriverManager.getConnection(DriverManager.java:664)
      at java.sql.DriverManager.getConnection(DriverManager.java:208)
      at OracleCon.main(OracleCon.java:33)
  Caused by: java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(SocketInputStream.java:210)
      at java.net.SocketInputStream.read(SocketInputStream.java:141)
      at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
      at sun.security.ssl.InputRecord.read(InputRecord.java:503)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
      at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:757)
      at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
      at oracle.net.ns.Packet.send(Packet.java:419)
      at oracle.net.ns.ConnectPacket.send(ConnectPacket.java:241)
      at oracle.net.ns.NSProtocolStream.negotiateConnection(NSProtocolStream.java:151)
      at oracle.net.ns.NSProtocol.connect(NSProtocol.java:263)
      at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1360)
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:486)
      ... 7 more
  </code></pre>