gpt4 book ai didi

java - 为什么我在使用 jooq 的 Firebird 中出现列未知异常?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:14:33 25 4
gpt4 key购买 nike

我想用 Jooq 生成一些类。

Jooq版本:3.8.2 Firebird 版本:2.5JDBC-Firebird-驱动程序: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 列在我的 Firebird 数据库中确实不存在。

我该如何解决这个问题?

最佳答案

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)。

关于java - 为什么我在使用 jooq 的 Firebird 中出现列未知异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38051478/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com