Test Database Connection on WebSphere Admin console is not a “full” test connection

A developer got this error

Error = Invalid Oracle URL specified DSRA0010E: SQL State = 99999, Error Code = 17,067

 when use the code bellow:

private void connectLookup() throws Exception {
        try {
                InitialContext ctx = new InitialContext();
                DataSource ds = (DataSource) ctx.lookup("jdbc/abcd1234");
                connection = ds.getConnection();

                if (connection == null) {
                        throw new Exception("Connection error....bla...bla..bla.");
        } catch (Exception e) {
                throw e;

When you test the connection on the websphere admin console everything is fine

Image:JDBC Connection and error

The problem was i forgot to set the field Authentication Alias for XA recovery.

Image:JDBC Connection and error