org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection 解決辦法
- 檢查pom檔案裡的座標的mysql版本是否匯入正確
<!-- mysql資料庫驅動包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
</dependency>
- 資料庫配置是否出錯
檢查專案的jdbc.properties檔案,如果是mysql 8的話,jdbc.driver應該是com.mysql.cj.jdbc.Driver,別忘了cj。
正確的配置應該是:
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/bank?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
jdbc.username=root
jdbc.password=root
如果是mysql 5的話,正確的配置應該是:
driverClassName=com.MySQL.jdbc.Driver
url=jdbc:mysql://localhost:3306/bank
username=root
password=root
注意:專案的jdbc.properties檔案的配置資訊與pom檔案裡匯入的mysql座標的版本應該匹配,否則就會報此異常
相關文章
- FTP Connection refused error 解決辦法FTPError
- Laravel 安裝 sail時ubuntu軟體源很慢或者connection failed 解決辦法LaravelAIUbuntu
- Cannot get a connection, pool exhausted解決辦法
- Failed to install *.apk on device null解決辦法AIAPKdevNull
- 解決Xmanager-AIX XDMCP Connection failedAI
- ConnectionManager.getConnection() failed to obtain a connection after 11 retries. The exception fromAIException
- FileZilla:425 Can't open data connection for transfer of解決辦法
- VMware 啟動報錯 "Failed to lock the file"解決辦法AI
- IDEA提示failed to load JVM DLL的解決辦法IdeaAIJVM
- RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED解決辦法ErrorDNNAI
- “Validation failed for one or more entities”異常的解決辦法AI
- VS 2017 Git failed with a fatal error的解決辦法GitAIError
- Connection to https://dl-ssl.google.com refused的解決辦法HTTPGo
- ssh 安裝及登入提示:connection refused的解決辦法
- vscode中Git: host key verification failed的解決辦法VSCodeGitAI
- SVN報錯“Failed to run the WC DB work queue associated with”解決辦法AI
- Navicat tnt版本提示“failed to save password error code”的解決辦法AIError
- docker dm_task_run failed 啟動失敗解決辦法DockerAI
- ORA-00313 open failed for members of log group解決辦法AI
- [nodemon] Internal watch failed: watch ENOSPC錯誤解決辦法AI
- PyCharm啟動報錯:Failed to create JVM.解決辦法之一PyCharmAIJVM
- Cargo invocation has failed: Error: exit code: 101.解決辦法CargoAIError
- Failed to upgrade Oracle Cluster Registry configuration的解決辦法AIOracle
- 解決sphinx connection to 127.0.0.1:9312 failed (errno=0, msg=)127.0.0.1AI
- org.hibernate.exception.JDBCConnectionException: Cannot open connection 解決辦法ExceptionJDBC
- command 'gcc' failed with exit status 1錯誤問題的解決辦法GCAI
- Oracle Universal Connection Pool(UCP) for JDBC 詳解OracleJDBC
- github慢解決辦法Github
- Grub Rescue解決辦法
- /dev/null解決辦法devNull
- MSBuild Tools解決辦法UI
- oracle出異常:Io 異常: The Network Adapter could not establish the connection 解決辦法OracleAPT
- 解決 Android studio Connect to 127.0.0.1:[/127.0.0.1] failed: Connection refusedAndroid127.0.0.1AI
- 解決java connectionJava
- 檔案無法粉碎解決辦法
- JDBC Connection Pool Example (轉)JDBC
- Apache無法啟動解決 the requested operation has failedApacheAI
- OpenStack 的NAT解決辦法