連接mysql時一直出現以下的錯誤:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database! org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:634) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
然后就將“
Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
” 當做問題的根源去搜索答案(當然,一搜發現這種錯誤還是挺多的)但是並不是我想要的答案
后來看到控制台的信息:
java.sql.SQLException: Unknown system variable 'query_cache_size'
原來這才是問題的根源所在!!!
原因是mysql驅動的版本號不匹配!!!(這篇博客簡直是救我於水深火熱之中)
直接抄過來了
如果mysql驅動版本號不匹配的話會出現:
java.sql.SQLException: Unknown system variable 'query_cache_size'
java.sql.SQLException: Unknown system variable 'tx_read_only'
java.sql.SQLException: Unknown system variable 'language'
解決辦法,到maven依賴查詢 去找到你安裝的mysql的版本對應的驅動版本號的配置
解決了這問題,又出現時區的問題,woc!!!
The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
請移步至這篇博客