liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Feld "WHITE" nicht gefunden Column "WHITE" not found; SQL statement: SELECT WHITE SPACE FROM PUBLIC.X WHERE 1 = 0 [42122-170]

JIRA | Lukas Eder | 4 years ago
  1. 0

    liquibase.database.AbstractDatabase.escapeColumnName() doesn't correctly escape all column names. Here's how to reproduce the issue with an H2 database: Create this table: {code:sql} CREATE TABLE x ( "WHITE SPACE" INT ) {code} Run this code snippet {code:java} Class.forName("org.h2.Driver"); Connection connection = DriverManager.getConnection("jdbc:h2:~/test", "sa", ""); H2Database database = new H2Database(); database.setConnection(new JdbcConnection(connection)); DatabaseSnapshot snapshot = DatabaseSnapshotGeneratorFactory .getInstance() .createSnapshot(database, "PUBLIC", null); {code} I then get this stack trace: {code} liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Feld "WHITE" nicht gefunden Column "WHITE" not found; SQL statement: SELECT WHITE SPACE FROM PUBLIC.X WHERE 1 = 0 [42122-170] at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:251) at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69) at org.jooq.test.liquibase2jooq.Adapters.before(Adapters.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.h2.jdbc.JdbcSQLException: Feld "WHITE" nicht gefunden Column "WHITE" not found; SQL statement: SELECT WHITE SPACE FROM PUBLIC.X WHERE 1 = 0 [42122-170] at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) at org.h2.message.DbException.get(DbException.java:169) at org.h2.message.DbException.get(DbException.java:146) at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:141) at org.h2.expression.Alias.optimize(Alias.java:47) at org.h2.command.dml.Select.prepare(Select.java:799) at org.h2.command.Parser.prepareCommand(Parser.java:218) at org.h2.engine.Session.prepareLocal(Session.java:414) at org.h2.engine.Session.prepareCommand(Session.java:363) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116) at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:70) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.isColumnAutoIncrement(JdbcDatabaseSnapshotGenerator.java:842) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readColumns(JdbcDatabaseSnapshotGenerator.java:369) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:244) ... 17 more {code} This can probably be reproduced with any database

    JIRA | 4 years ago | Lukas Eder
    liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Feld "WHITE" nicht gefunden Column "WHITE" not found; SQL statement: SELECT WHITE SPACE FROM PUBLIC.X WHERE 1 = 0 [42122-170]
  2. 0

    liquibase.database.AbstractDatabase.escapeColumnName() doesn't correctly escape all column names. Here's how to reproduce the issue with an H2 database: Create this table: {code:sql} CREATE TABLE x ( "WHITE SPACE" INT ) {code} Run this code snippet {code:java} Class.forName("org.h2.Driver"); Connection connection = DriverManager.getConnection("jdbc:h2:~/test", "sa", ""); H2Database database = new H2Database(); database.setConnection(new JdbcConnection(connection)); DatabaseSnapshot snapshot = DatabaseSnapshotGeneratorFactory .getInstance() .createSnapshot(database, "PUBLIC", null); {code} I then get this stack trace: {code} liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Feld "WHITE" nicht gefunden Column "WHITE" not found; SQL statement: SELECT WHITE SPACE FROM PUBLIC.X WHERE 1 = 0 [42122-170] at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:251) at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69) at org.jooq.test.liquibase2jooq.Adapters.before(Adapters.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.h2.jdbc.JdbcSQLException: Feld "WHITE" nicht gefunden Column "WHITE" not found; SQL statement: SELECT WHITE SPACE FROM PUBLIC.X WHERE 1 = 0 [42122-170] at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) at org.h2.message.DbException.get(DbException.java:169) at org.h2.message.DbException.get(DbException.java:146) at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:141) at org.h2.expression.Alias.optimize(Alias.java:47) at org.h2.command.dml.Select.prepare(Select.java:799) at org.h2.command.Parser.prepareCommand(Parser.java:218) at org.h2.engine.Session.prepareLocal(Session.java:414) at org.h2.engine.Session.prepareCommand(Session.java:363) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116) at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:70) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.isColumnAutoIncrement(JdbcDatabaseSnapshotGenerator.java:842) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readColumns(JdbcDatabaseSnapshotGenerator.java:369) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:244) ... 17 more {code} This can probably be reproduced with any database

    JIRA | 4 years ago | Lukas Eder
    liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Feld "WHITE" nicht gefunden Column "WHITE" not found; SQL statement: SELECT WHITE SPACE FROM PUBLIC.X WHERE 1 = 0 [42122-170]
  3. 0

    org.h2.jdbc.JdbcSQLException: Table SYSTEM_SEQUENCES not found; SQL statement

    Google Groups | 7 years ago | Varun
    org.h2.jdbc.JdbcSQLException: Table SYSTEM_SEQUENCES not found; SQL statement: select sequence_name from information_schema.system_sequences [42102-114]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    jsf - JSF com Wildfly 8 404 - Not Found

    com.br | 1 year ago
    org.h2.jdbc.JdbcSQLException: Table "PG_CLASS" not found; SQL statement: select relname from pg_class where relkind='S' [42102-173]
  6. 0

    [ConnectionsReleaseTest|https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/ConnectionsReleaseTest.java] fails on most databases (db2, mssql, oracle, postgresql, sybase). example failure - db2: {noformat} org.hibernate.exception.GenericJDBCException: Error creating DatabaseInformation for schema validation at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:84) at org.hibernate.test.schemaupdate.ConnectionsReleaseTest.testSchemaValidatorReleasesAllConnections(ConnectionsReleaseTest.java:86) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) Caused by: org.h2.jdbc.JdbcSQLException: Schema "SYS" not found; SQL statement: select name from sys.sequences [90079-176] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) at org.h2.message.DbException.get(DbException.java:178) at org.h2.message.DbException.get(DbException.java:154) at org.h2.command.Parser.getSchema(Parser.java:655) at org.h2.command.Parser.getSchema(Parser.java:662) at org.h2.command.Parser.readTableFilter(Parser.java:1186) at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1859) at org.h2.command.Parser.parseSelectSimple(Parser.java:1968) at org.h2.command.Parser.parseSelectSub(Parser.java:1853) at org.h2.command.Parser.parseSelectUnion(Parser.java:1674) at org.h2.command.Parser.parseSelect(Parser.java:1662) at org.h2.command.Parser.parsePrepared(Parser.java:434) at org.h2.command.Parser.parse(Parser.java:306) at org.h2.command.Parser.parse(Parser.java:278) at org.h2.command.Parser.prepareCommand(Parser.java:243) at org.h2.engine.Session.prepareLocal(Session.java:442) at org.h2.engine.Session.prepareCommand(Session.java:384) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188) at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:75) at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:42) at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.initializeSequences(DatabaseInformationImpl.java:64) at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.<init>(DatabaseInformationImpl.java:60) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:80) ... 13 more {noformat} Test opens connection to H2 so it should use H2Dialect {code:java} public static Properties getConnectionProviderProperties() { Properties props = new Properties(); props.put( Environment.DRIVER, "org.h2.Driver" ); props.put( Environment.URL, String.format( "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1", "db1" ) ); props.put( Environment.USER, "sa" ); props.put( Environment.PASS, "" ); return props; } {code}

    Hibernate JIRA | 9 months ago | Martin Ċ imka
    org.hibernate.exception.GenericJDBCException: Error creating DatabaseInformation for schema validation

  1. musketyr 1 times, last 1 month ago
9 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.h2.jdbc.JdbcSQLException

    Feld "WHITE" nicht gefunden Column "WHITE" not found; SQL statement: SELECT WHITE SPACE FROM PUBLIC.X WHERE 1 = 0 [42122-170]

    at org.h2.message.DbException.getJdbcSQLException()
  2. H2 Database Engine
    JdbcStatement.executeQuery
    1. org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
    2. org.h2.message.DbException.get(DbException.java:169)
    3. org.h2.message.DbException.get(DbException.java:146)
    4. org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:141)
    5. org.h2.expression.Alias.optimize(Alias.java:47)
    6. org.h2.command.dml.Select.prepare(Select.java:799)
    7. org.h2.command.Parser.prepareCommand(Parser.java:218)
    8. org.h2.engine.Session.prepareLocal(Session.java:414)
    9. org.h2.engine.Session.prepareCommand(Session.java:363)
    10. org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116)
    11. org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:70)
    11 frames
  3. Liquibase Core
    DatabaseSnapshotGeneratorFactory.createSnapshot
    1. liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.isColumnAutoIncrement(JdbcDatabaseSnapshotGenerator.java:842)
    2. liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readColumns(JdbcDatabaseSnapshotGenerator.java:369)
    3. liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:244)
    4. liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69)
    4 frames
  4. org.jooq.test
    Adapters.before
    1. org.jooq.test.liquibase2jooq.Adapters.before(Adapters.java:63)
    1 frame
  5. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:601)
    4 frames
  6. JUnit
    ParentRunner.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    4. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    5. org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    5 frames
  7. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    1 frame
  8. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    5 frames