Any user have login/password in Oracle database. I have a code:
Connection con;
Statement stmt = null;
String query = "SELECT user FROM dual";
try {
dataSource = (DataSource) new InitialContext().lookup("jdbc/MyDataSource");
} catch (NamingException e) {
throw new ExceptionInInitializerError(e);
}
try {
System.out.println("name, password:" + name + "|" + password);
con = dataSource.getConnection(name, password);
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.println("User:" + rs.getString("USER"));
}
con.close();
return true;
} catch (SQLException ex) {
Logger.getLogger(UserInfoServiceOracle.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
If I put a correct password, next user could getConnection using any login/password and with login/password from first correct user.
Log:
INFO: name, password:correctUser|correctPassword
INFO: User:correctUser
INFO: name, password:jhkjhkjh|khkjhkj
INFO: User:correctUser