【问题标题】:Property leakDetectionThreshold does not exist on target class org.postgresql.ds.PGSimpleDataSource目标类 org.postgresql.ds.PGSimpleDataSource 上不存在属性 leakDetectionThreshold
【发布时间】:2017-03-09 20:01:44
【问题描述】:

我正在尝试使用此属性,但它给了我异常,我什至尝试使用:pgjdbc-ng | com.impossibl.postgres.jdbc.PGDataSource 但没有成功,它给了我同样的标题例外。

ERROR com.zaxxer.hikari.util.PropertyElf - Property leakDetectionThreshold  does not exist on target class org.postgresql.ds.PGSimpleDataSource

java.lang.RuntimeException: Property leakDetectionThreshold  does not exist on target class org.postgresql.ds.PGSimpleDataSource

HirakriCP 配置:

    ds = new HikariDataSource();
    ds.setMaximumPoolSize(poolSize);
    ds.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
    ds.addDataSourceProperty("serverName", serverAddress);
    ds.addDataSourceProperty("databaseName", database);
    ds.addDataSourceProperty("user", user);
    ds.addDataSourceProperty("portNumber", port);
    ds.addDataSourceProperty("password", password);
    ds.addDataSourceProperty("leakDetectionThreshold ", 5000);

或者:

    ds.setDataSourceClassName("com.impossibl.postgres.jdbc.PGDataSource");
    ds.addDataSourceProperty("host", serverAddress);
    ds.addDataSourceProperty("database", database);
    ds.addDataSourceProperty("user", user);
    ds.addDataSourceProperty("port", port);
    ds.addDataSourceProperty("password", password);

我可能做错了什么吗?我很害怕我在互联网上找不到有同样问题的人oO

比你提前, 亚历山大

【问题讨论】:

    标签: postgresql hikaricp


    【解决方案1】:

    leakDetectionThreshold 不是驱动属性,我们需要像这样设置这个数据源属性:

        ds = new HikariDataSource();
        ds.setLeakDetectionThreshold(5000);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-15
      • 2018-01-07
      • 2018-10-13
      • 1970-01-01
      • 2019-02-02
      • 1970-01-01
      • 2020-08-15
      • 2019-12-23
      相关资源
      最近更新 更多