import java.sql.*;
import java.util.HashSet;
import java.io.FileInputStream;
import java.util.Properties;
class jdbcConnectionOverflow {
 public static void main (String args [])
 throws Exception {
 DriverManager.registerDriver(new
         oracle.jdbc.driver.OracleDriver());
 Properties props = new Properties();
 props.load(new FileInputStream("conn.props"));
 String url = props.getProperty("url");
 Connection conn;
 Statement stmt;
 ResultSet rset;
 int i = 0;
 HashSet<Connection> s = new HashSet<Connection>();
 while (true) {
  try { Thread.sleep(200);  i++;  System.out.println(i);
    conn = DriverManager.getConnection(url, props);
    s.add(conn);
    stmt = conn.createStatement();
    rset = stmt.executeQuery("select * from qwertz");
  } catch (SQLException e) { e.printStackTrace(); }
    catch (InterruptedException ex) {
             Thread.currentThread().interrupt(); }
}}}
/* ADMIN only:
select username, count(*) from V$SESSION group by username; */
