Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create table on embedded DB using GENERATED BY [JDBC507] #543

Closed
firebird-automations opened this issue Sep 7, 2017 · 3 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: ac0v (ac0v)

I'm trying to create a table via Jaybird 3.0.2 by issuing:

CREATE TABLE foo(id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name, VARCHAR(100) NOT NULL);

That results in:

[SEVERE] 2017-09-07 18:50:06 nxt.Nxt - Database error executing CREATE TABLE foo(id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name, VARCHAR(100) NOT NULL);
java.lang.RuntimeException: Database error executing CREATE TABLE foo(id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name, VARCHAR(100) NOT NULL);
at ...
Caused by: java.sql.SQLSyntaxErrorException: Dynamic SQL Error; SQL error code = -104; Token unknown - line 1, column 38; BY [SQLState:42000, ISC error code:335544634]
at org.firebirdsql.gds.ng.FbExceptionBuilder$Type$1.createSQLException(FbExceptionBuilder.java:495)
at org.firebirdsql.gds.ng.FbExceptionBuilder.toFlatSQLException(FbExceptionBuilder.java:299)
at org.firebirdsql.gds.ng.jna.JnaConnection.processStatusVector(JnaConnection.java:146)
at org.firebirdsql.gds.ng.jna.JnaDatabase.processStatusVector(JnaDatabase.java:483)
at org.firebirdsql.gds.ng.jna.JnaStatement.processStatusVector(JnaStatement.java:437)
at org.firebirdsql.gds.ng.jna.JnaStatement.prepare(JnaStatement.java:146)
at org.firebirdsql.jdbc.FBStatement.prepareFixedStatement(FBStatement.java:1368)
at org.firebirdsql.jdbc.FBStatement.internalExecute(FBStatement.java:1354)
at org.firebirdsql.jdbc.FBStatement.executeUpdate(FBStatement.java:280)
at com.zaxxer.hikari.pool.ProxyStatement.executeUpdate(ProxyStatement.java:117)
at com.zaxxer.hikari.pool.HikariProxyStatement.executeUpdate(HikariProxyStatement.java)
at nxt.db.firebird.FirebirdDbVersion.apply(FirebirdDbVersion.java:52)
... 6 more
Caused by: org.firebirdsql.jdbc.FBSQLExceptionInfo: Dynamic SQL Error

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

security: Developers [ 10012 ] =>

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

The problem is that you are either using an embedded library of Firebird 2.5 or earlier, or connecting to a localhost Firebird 2.5 or earlier. This last thing can happen if you use a Firebird 3 fbclient.dll, but did not include the Firebird 3 engine12.dll (or http://libengine12.so) plugin and other libraries required by Firebird embedded.

I suggest that you add the following to your program to check which Firebird version you are using:

DatabaseMetaData md = connection.getMetaData();
System.out.println("database product version: " + md.getDatabaseProductVersion());

Note the tracker is not meant for support questions but only for bug reports. If you need more help, please post a follow up question to the Firebird-java mailinglist.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Closed [ 6 ]

resolution: Cannot Reproduce [ 5 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants