hibernate在sqlserver数据库上能创建成功,然后把数据库切换到mysql只能成功创建一部分数据库,还有大部分数据库表创建不成功。我的数据表没有外键的限制所以网上说的答案不符合我的要求。有人知道hibernate怎么创建表成功在mysql数据库里

解决方案 »

  1.   

    WARN  [main] org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean     - Unsuccessful schema statement: create table dbo.CM_PBN_EOC_UPDATE (NEID int not null, MASTERFILE varchar(64) null, MASTERID int not null, SERVERIP varchar(255) null, SERVERLOGIN varchar(15) null, SERVERPASS
    WORD varchar(15) null, SERVERPORT int null, SLAVEFILE varchar(64) null, primary key (NEID))java.sql.SQLException: Syntax error or access violation message from server: "Unknown database 'dbo'"
      

  2.   

    在MYSQL命令行下检查一下有什么数据库
      

  3.   

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan" value="com.pbn.boss.model.hibernate"></property>
    <property name="schemaUpdate" value="true" />
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.format_sql">true</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.default_schema">dbo</prop>
    <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
    <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
    </props>
    </property>
    </bean>
      

  4.   

    如果把<prop key="hibernate.default_schema">dbo</prop>去掉就会报
    java.sql.SQLException: General error message from server: "Can't create table '.\nms3e2\user_info.frm' (errno: 121)"