java.sql.SQLRecoverableException: IO Error: Connection reset by peer, Authentication lapse

· klm's blog


Original post is here: eklausmeier.goip.de

I encountered the following error, when I wanted to connect to Oracle v12.2.0.1.0 database with Java 1.8.0_192-b26:

1java.sql.SQLRecoverableException: IO Error: Connection reset by peer, Authentication lapse 321631 ms.

This was unexpected as the same program did run absolutely fine on another Linux machine. Program in question is

 1import java.sql.Connection;
 2import java.sql.SQLException;
 3
 4import oracle.jdbc.pool.OracleDataSource;
 5
 6public class OraSample1 {
 7
 8        public static void main (String argv[]) {
 9                System.out.println("Starting...");
10                try {
11                        OracleDataSource ds = new OracleDataSource();
12                        ds.setURL("jdbc:oracle:thin:@nuc:1521:orcl");
13                        Connection conn=ds.getConnection("c##klm","klmOpRisk");
14                        System.out.println("Connected");
15                } catch (SQLException e) {
16                        System.out.println(e);
17                }
18        }
19
20}

Solution: Add the following property setting to command line

1java -Djava.security.egd=file:/dev/urandom OraSample1

Also see “java.sql.SQLException: I/O Error: Connection reset” in linux server [duplicate] on Stackoverflow.