MiddlegenException: Middlegen successfully connected to the database

环境:

1).Middlegen-Hibernate-r5

2).Database: SQL Server 2000

3).Driver: jtds-1.2.5.jar

 

报如下的Exception:

D:\soft\java\java\hibernate\tool\Middlegen-Hibernate-r5\build.xml:148:
middlegen.MiddlegenException: Middlegen successfully connected to the database, but  could n't find any tables. Perhaps the specified schema or catalog is wrong? -Or maybe there aren't any tables in the database at all?

Configured schema:sa

Configured catalog:

Available schemas:

  dbo

  guest

  ternce

Available catalogs:

  master

  msdb

  Netword

  Northwind

 

我的解决该Exception的过程:

 1).将database.script.file的value改为${src.dir}/sql/${name}-mssql.sql

 2).将jtds-1.2.5.jar加入到Middlegen-Hibernate-r5\lib\目录内

 3).将build.xml文件的database.driver.file的value修改为:<property name="database.driver.file"           value="${lib.dir}/jtds-1.2.5.jar"/>

 4).将build.xml文件的database.schema和database.catalog的value改为:

    <property name="database.schema"            value="dbo"/>

    <property name="database.catalog"            value="Netword"/>

    database.catalog的value与database.url中的databaseName相同

 

我的build.xml文件如下:

   <!-- ===================================================================
-->

   <!-- ant properties/targets for MS SQL Server
-->

   <!-- note: this is not a proper xml file (there is no root element)
-->

   <!--       it is intended to be imported from a *real* xml file   gwideal
-->

   <!-- ===================================================================
-->

 

   <property name="database.script.file" value="${src.dir}/sql/${name}-mssql.sql"/>

   <property name="database.driver.file"           value="${lib.dir}/jtds-1.2.5.jar"/>

   <property name="database.driver.classpath"      value="${database.driver.file}"/>

   <property name="database.driver" value="net.sourceforge.jtds.jdbc.Driver"/>

   <property name="database.url"
value="jdbc:jtds:sqlserver://172.18.19.9:1433/Netword"/>

   <property name="database.userid"                value="sa"/>

   <property name="database.password"              value=""/>

   <property name="database.schema"                value="dbo"/>

   <property name="database.catalog"               value="Netword"/>

   <property name="jboss.datasource.mapping"       value="MS SQLSERVER2000"/>

 

你可能感兴趣的:(sql,Hibernate,xml,jdbc,SQL Server)