1. 程式人生 > >Cannot create PoolableConnectionFactory (Access denied for user ''@'localhost' (using password: YES)

Cannot create PoolableConnectionFactory (Access denied for user ''@'localhost' (using password: YES)

Cannot create PoolableConnectionFactory (Access denied for user ‘’@‘localhost’ (using password: YES))在使用dbcp連線池獲取資料庫連線時出現的異常解決方法

按照提示我們可以看到沒有檢測到使用者名稱我們將配置檔案中的url由:

url=jdbc:mysql://localhost:3306/mysqltest?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true

改為:

url=jdbc:mysql://[email protected]:3306/mysqltest?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true

這樣我們再進行測試就沒有問啦。