public OlapConnection createConnection(final String user, final String password) throws SQLException
{
try
{
final Context ctx = getInitialContext();
final DataSource ds = findDataSource(ctx, connectionPath);
final String realUser;
final String realPassword;
if (username != null)
{
realUser = username;
}
else
{
realUser = user;
}
if (this.password != null)
{
realPassword = this.password;
}
else
{
realPassword = password;
}
if (realUser == null)
{
final Connection connection = ds.getConnection();
if (connection == null)
{
throw new SQLException("JNDI DataSource is invalid; it returned null without throwing a meaningful error.");
}
if (connection instanceof OlapConnection)
{
return (OlapConnection) connection;
}
if (connection instanceof OlapWrapper)
{
final OlapWrapper wrapper = (OlapWrapper) connection;
return wrapper.unwrap(OlapConnection.class);
}
throw new SQLException("Unable to unwrap the connection: " + connectionPath); //$NON-NLS-1$
}
final Connection connection = ds.getConnection(realUser, realPassword);
if (connection == null)
{
throw new SQLException("JNDI DataSource is invalid; it returned null without throwing a meaningful error.");
}
if (connection instanceof OlapConnection)