曲脖向天歌 2015-04-13 01:41 采纳率: 0%
浏览 2939

SSH连接数据库时,无法自动创建表,且tomcat无法启动

jdbc配置:
driverClass=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mydata
user=root
password=root

当数据库中没有mydata表时,无法自动创建,且tomcat启动不了,停留在Initializing Spring root WebApplicationContext。如果手动创建mydata表,tomcat可以启动,项目也能运行。
hibernate配置:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">


    <!-- 数据库言 -->
    <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>

    <!-- 加载二级缓存插件(可选) -->
    <property name="hibernate.cache.region.factory_class">org.hibernate.cache.EhCacheRegionFactory</property>
    <property name="hibernate.cache.use_query_cache">true</property>


    <!-- 配置自动生成DDL语句 -->
    <property name="hibernate.hbm2ddl.auto">update</property>
    <!-- 在控制台打印出当前的sql语句 -->
    <property name="hibernate.show_sql">true</property>

    <!-- 注册对象关系映射 -->


</session-factory>

  • 写回答

4条回答 默认 最新

  • 蒸蒸蒸蒸灬 2015-04-13 03:30
    关注

    tomcat无法启动应该有报错提示,你先看下报错的地址是哪里... 目测可能是连接那边的问题, 然后hibernate那边要配置pojo的package扫描,不然不知道要生成哪些表...

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog