我想用Jooq生成一些类。
Jooq版本:3.8.2火鸟版本:2.5JDBC-Firebird-Driver: 2.1.6
这是我的Config.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.7.0.xsd">
<jdbc>
<driver>org.firebirdsql.jdbc.FBDriver</driver>
<url>jdbc:firebirdsql:localhost/3050://var/lib/firebird/2.5/data/db.gdb?encoding=ISO8859_1</url>
<user>sysdba</user>
<password>masterkey</password>
</jdbc>
<generator>
<name>org.jooq.util.JavaGenerator</name>
<database>
<name>org.jooq.util.firebird.FirebirdDatabase</name>
<includes>.*</includes>
<excludes>RDB$.*|MON$.*|SEC$.*</excludes>
<inputSchema></inputSchema>
</database>
<generate>
<pojosEqualsAndHashCode>true</pojosEqualsAndHashCode>
<pojos>true</pojos>
</generate>
<target>
<packageName>models.gen</packageName>
<directory>./app</directory>
</target>
</generator>
</configuration>
如果我运行jooq,我得到一个SQL错误:
SQL error code = -206
Column unknown
RDB$PROCEDURES.RDB$PROCEDURE_TYPE
At line 1, column 208
Please report this bug here: https://github.com/jOOQ/jOOQ/issues/new
select
trim("RDB$RELATIONS"."RDB$RELATION_NAME"),
0 "table_valued_function"
from "RDB$RELATIONS"
union all
select
trim("RDB$PROCEDURES"."RDB$PROCEDURE_NAME"),
1 "table_valued_function"
from "RDB$PROCEDURES"
where (
"RDB$PROCEDURES"."RDB$PROCEDURE_TYPE" = 1
and 1 = 0
)
order by 1 asc
Jun 27, 2016 11:35:01 AM org.jooq.tools.JooqLogger error
SCHWERWIEGEND: Error while fetching tables
org.jooq.exception.DataAccessException: SQL [select trim("RDB$RELATIONS"."RDB$RELATION_NAME"), 0 "table_valued_function" from "RDB$RELATIONS" union all select trim("RDB$PROCEDURES"."RDB$PROCEDURE_NAME"), 1 "table_valued_function" from "RDB$PROCEDURES" where ("RDB$PROCEDURES"."RDB$PROCEDURE_TYPE" = cast(? as smallint) and 1 = 0) order by 1 asc]; GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -206
Column unknown
RDB$PROCEDURES.RDB$PROCEDURE_TYPE
At line 1, column 208
at org.jooq.impl.Tools.translate(Tools.java:1908)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:659)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:362)
at org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:312)
at org.jooq.impl.AbstractResultQuery.iterator(AbstractResultQuery.java:323)
at org.jooq.impl.SelectImpl.iterator(SelectImpl.java:2715)
at org.jooq.util.firebird.FirebirdDatabase.getTables0(FirebirdDatabase.java:241)
at org.jooq.util.AbstractDatabase.getTables(AbstractDatabase.java:980)
at org.jooq.util.SchemaDefinition.getTables(SchemaDefinition.java:74)
at org.jooq.util.JavaGenerator.generateSchema(JavaGenerator.java:3638)
at org.jooq.util.JavaGenerator.generateSchema(JavaGenerator.java:3604)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:350)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:317)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:282)
at org.jooq.util.GenerationTool.run(GenerationTool.java:533)
at org.jooq.util.GenerationTool.generate(GenerationTool.java:195)
at org.jooq.util.GenerationTool.main(GenerationTool.java:166)
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -206
Column unknown
RDB$PROCEDURES.RDB$PROCEDURE_TYPE
At line 1, column 208
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:147)
at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:92)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:890)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:845)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:838)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:314)
at org.jooq.impl.ProviderEnabledConnection.prepareStatement(ProviderEnabledConnection.java:112)
at org.jooq.impl.SettingsEnabledConnection.prepareStatement(SettingsEnabledConnection.java:76)
at org.jooq.impl.AbstractResultQuery.prepare(AbstractResultQuery.java:231)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:320)
... 14 more
列RDB$PROCEDURE_TYPE在我的火鸟数据库中真的不存在
我该如何解决这个问题?
RDB$PROCEDURE_TYPE
是在Firebird 2.0 (On-Disk-Structure (ODS) 11.0)中引入的。从外观上看,您的数据库是ODS 10 (Interbase 6/Firebird 1.0)。要在数据库中获取这一列,需要通过备份数据库和恢复数据库来升级ODS。这将把数据库升级到ODS 11.2 (Firebird 2.5)。