SeunMatt/mysql-backup4j

Import fails when using a database user with empty password

SeunMatt opened this issue · 1 comments

This is happening because of the validation that checks that
the password is not null and empty on line 145 of MysqlImportService

Example code to reproduce

String sql = new String(Files.readAllBytes(Paths.get("external/test_output_file_name.sql")));
        MysqlImportService res = MysqlImportService.builder();
        res.setJdbcDriver("com.mysql.cj.jdbc.Driver");
        res.setJdbcConnString("jdbc:mysql://localhost:3306/backup4j_test?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&useSSL=false");
        res.setSqlString(sql);
        res.setUsername("smatt");
        res.setPassword("smatt");
        res.setDropExisting(true);
        assertTrue(res.importDatabase());

Fixed in version 1.2.0