我正在使用此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 Standard数据类型?
答案 0 :(得分:1)
使用时间戳代替 DATETIME
<column name="LocationModifyDate" type="TIMESTAMP" required="true" />
在这里阅读postgresql中的日期/时间手册:
http://www.postgresql.org/docs/9.1/static/datatype-datetime.html