public void setCredential(String username, String password) {
	if (username != null) {
	    env.put("java.naming.security.principal", username);
	    env.put("java.naming.security.credentials", password);
	}
	else {
	    env.remove("java.naming.security.principal");
	    env.remove("java.naming.security.credentials");
	}
    }
public void setCredential ( String username , String password ) { if ( username != null ) { env . put ( "java.naming.security.principal" , username ) ; env . put ( "java.naming.security.credentials" , password ) ; } else { env . remove ( "java.naming.security.principal" ) ; env . remove ( "java.naming.security.credentials" ) ; } }
sets username password for the connection

@param username
@param password