-1

I tried unsuccessfully configure hikaricp and I don't see error in the code please help.

public class DatabaseManager {

    private DatabaseClient[] databaseClients;
    private HikariDataSource hikariDataSource;

    public DatabaseManager(String absoluteFilePath) {
        final HikariConfig hikariConfig = new  HikariConfig(absoluteFilePath);
        this.hikariDataSource = new HikariDataSource(hikariConfig);
        System.out.println(hikariConfig.getUsername()); // null u-u
    }
}

Properties file:

## Database Settings
dataSourceClassName=org.mariadb.jdbc.MySQLDataSource
dataSource.user=root
dataSource.password=
dataSource.databaseName=imagine-db
dataSource.portNumber=3306
dataSource.serverName=localhost
KrozT
  • 99
  • 1
  • 2

1 Answers1

0

You've set the username on the data source not on the config itself. This will still work fine but you can't access it using hikariConfig.getUsername().

Try adding this to your properties file if you really need to access the user like that, although I suspect you don't.

username=root
password=
Eddie Curtis
  • 1,207
  • 8
  • 20