java - 无法从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:
想知道可能是什么原因造成的,任何帮助都会很棒。
解决方案
推荐阅读
- .net - 使用 signtool 对 WIX 工具生成的 setup.exe 进行签名会导致访问被拒绝错误
- node.js - Node JS pkg 可执行文件无法从外部读取文件?
- typescript - 如何制作可以调用但不能被视为值的打字稿函数?
- google-sheets - 当每列有不同的公式时,如何在整个工作表中替换#N/A?
- flutter - 为什么我的内联箭头函数没有按预期改变状态?
- node.js - AWS S3 签名 URL 包含 AccessKeyId
- ios - RealityKit:在接地阴影下渲染对象
- django - 基于HTTP方法的Django rest框架non_atomic_requests
- c# - 方面未触发 CQRS
- actions-on-google - 拒绝帐户关联后奇怪的 Google 助理行为