everyone!

I'm using the free account of OpenShift by RedHat PaaS to host my java aplication. For tests, I created an aplication that just get two user info (login and password) in the index.jsp, then it search into database and redirect to the success page(message "Good morning/afternoot/night, ${user.name}") or a failure page (message "You're not registred"). I also created a database, called autenticacao, with one table called usuario (user) in phpMyAdmin and this works well in localhost. But in the openshift, my servlet receives a null 'usuario' (user) object from the method obter(String login, String senha), that should get a result of one select query. I think it doesnt create a database connection. I've really tried so hard to make it works, and seen too many solutions in foruns (also here in stackoverflow) and nothing works.

Im using some design patterns but I think it's not a problem.

This is my DatabaseLocator.java:`

```
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package dao;

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;

    /**
     *
     * @author Luiz
     */
    public class DatabaseLocator {

        private static DatabaseLocator instance = new DatabaseLocator();

        public static DatabaseLocator getInstance() {
        return instance;
    }

    private DatabaseLocator() {

    }

    public Connection getConnection() throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.jdbc.Driver");
        String user = System.getenv("OPENSHIFT_MYSQL_DB_USERNAME");
        String password = System.getenv("OPENSHIFT_MYSQL_DB_PASSWORD");
        String url = System.getenv("OPENSHIFT_MYSQL_DB_URL");
        String host = System.getenv("OPENSHIFT_MYSQL_DB_HOST");
        String port = System.getenv("OPENSHIFT_MYSQL_DB_PORT");
        Connection conn
                = DriverManager.getConnection(host+port+"/autenticacao",user,password);
        return conn;  

    }
}

```

The error happens when I try create a connection in st = conn.createStatement(); part.

```
public Usuario obterUsuario(String login, String password) {
    Usuario usuario = null;
    Connection conn = null;
    Statement st = null;
    try {
        conn = DatabaseLocator.getInstance().getConnection();
        st = conn.createStatement();
        ResultSet rs = st.executeQuery("select * from usuario where login='" + login + "' and senha='" + password + "'");
        rs.first();
        usuario = instanciar(rs);
    } catch (ClassNotFoundException cnf) {

    } catch (SQLException ex) {
        System.out.println(ex.getCause());
    }

    return usuario;
}

public static Usuario instanciar(ResultSet rs) throws SQLException, ClassNotFoundException {
    Usuario usuario = new Usuario();
    usuario.setLogin(rs.getString("login"));
    usuario.setSenha(rs.getString("senha"));
    //other rs fields that would be setted to user object
    return user;
}

```

}

This code is in portuguese, so if any word doesnt make sense, you can ask me. I have some other classes, I can show it if you want. 

So, how can I connect to my database? Can you help me? Thanks.