用eclipse 建立的maven项目 连接Mysql数据库,运行时报错,这是什么原因?

用eclipse 建立的maven项目 连接Mysql数据库,运行时报错,这是什么原因?,第1张

可能是以下的其中一种情况:

一:连接URL格式出现了问题(Connection conn=DriverManager.

getConnection("jdbc:mysql://localhost:3306/XX","root","XXXX")

二:驱动字符串出错(com.mysql.jdbc.Driver)

三:Classpath中没有加入合适的mysql_jdbc驱动(驱动要和你的数据库版本一致)

四:驱动jar包放的位置不对

部分报错信息

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failednested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

2019-12-13 18:09:19.869 INFO 91776 — [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]

2019-12-13 18:09:19.879 INFO 91776 — [ restartedMain] utoConfigurationReportLoggingInitializer :


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/8705700.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-20
下一篇2023-04-20

发表评论

登录后才能评论

评论列表(0条)

    保存