2017-03-09 25 views
0

我想使用此屬性,但它給了我例外,我甚至試過用:pgjdbc-納克| com.impossibl.postgres.jdbc.PGDataSource但沒有成功,它給了我相同的標題異常。物業leakDetectionThreshold不會對目標類存在org.postgresql.ds.PGSimpleDataSource

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

比你提前了同樣的問題的人, 亞歷山大

回答

0

leakDetectionThreshold不是我們需要設置這個DataSource屬性像這樣的驅動程序屬性:

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