首页 > 解决方案 > 无法从DataSource获取Jdbc连接,不支持认证类型10

问题描述

        Flyway flyway = new Flyway();

        CrsProperties properties = new CrsPropertiesFactory().get();

        //flyway.setDataSource(properties.getProperty("databaseUrl"),
                //properties.getProperty("databaseUsername"),
                //properties.getProperty("databasePassword"));
        flyway.setDataSource("jdbc:postgresql://localhost/ert", "postgres", "postgres");

        flyway.setLocations("db.migration.structural", "db.migration.seed");

        flyway.clean(); // fails here
        flyway.setInitOnMigrate(true);
        flyway.migrate();

完整的错误信息:

线程“主”com.googlecode.flyway.core.api.FlywayException 中的异常:无法从 com.googlecode.flyway.core.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56) 处的数据源获取 Jdbc 连接.googlecode.flyway.core.Flyway.execute(Flyway.java:1174) 在 com.googlecode.flyway.core.Flyway.clean(Flyway.java:929) 在 org..crs.migration.DatabaseSetup.main(DatabaseSetup. java:26) 原因:org.postgresql.util.PSQLException:不支持身份验证类型 10。检查您是否已将 pg_hba.conf 文件配置为包含客户端的 IP 地址或子网,并且它正在使用驱动程序支持的身份验证方案。在 org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:401) 在 org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:

想知道可能是什么原因造成的,任何帮助都会很棒。

标签: javapostgresqlwildflyflyway

解决方案


推荐阅读