0

我正在使用此 XML 文档将特定表加载到 postgresql 数据库中:

create_table.xml:

<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
<database name="sample">
    <table name="Location">
        <column name="LocationID" type="INTEGER" primaryKey="true" />
        <column name="LocationModifyDate" type="DATETIME" required="true" />
    </table>
</database>

但是当我加载它时,我得到一个异常:

An exception occurred.  Please see the following for details:
-------------------------------------------------------------------------------
org.jumpmind.db.model.ModelException: Unknown JDBC type DATETIME
  at org.jumpmind.db.model.Column.setMappedType(Column.java:283)
  at org.jumpmind.db.io.DatabaseXmlUtil.nextTable(DatabaseXmlUtil.java:202)
  at org.jumpmind.symmetric.io.data.reader.XmlDataReader.readNext(XmlDataReader.java:139)
  at org.jumpmind.symmetric.io.data.reader.XmlDataReader.open(XmlDataReader.java:75)
  at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:84)
  at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:78)
  at org.jumpmind.symmetric.io.data.DbImport.importTablesFromXml(DbImport.java:208)
  at org.jumpmind.symmetric.io.data.DbImport.importTables(DbImport.java:154)
  at org.jumpmind.symmetric.DbImportCommand.executeWithOptions(DbImportCommand.java:188)
  at org.jumpmind.symmetric.AbstractCommandLauncher.execute(AbstractCommandLauncher.java:130)
  at org.jumpmind.symmetric.DbImportCommand.main(DbImportCommand.java:72)

我用来加载 XML 文件的命令是这样的:

../bin/dbimport --engine corp-000 -format XML create_table.xml

如果我使用 INTEGER 而不是 DATETIME,则会正确处理 XML 文件并创建表。

这个例外是什么意思?也许我必须使用 JDBC 标准数据类型?

4

1 回答 1

1

使用时间戳而不是DATETIME

    <column name="LocationModifyDate" type="TIMESTAMP" required="true" />

在此处阅读 postgresql 中的日期/时间手册:

http://www.postgresql.org/docs/9.1/static/datatype-datetime.html

于 2013-08-17T21:13:04.610 回答