liquibase.exception.DatabaseException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • This method uses a Call statement, which is not supported for sybase when executing select user_name() , Sybase requires a prepared statement to be used here. Call statement should only be used to call a stored procedure, not to run a regular 'select' This page put me on the right track: https://sourceforge.net/p/jtds/discussion/104389/thread/102edfcd/ protected String getConnectionSchemaName() { if (connection == null || connection instanceof OfflineConnection) { return null; } try { String currentSchemaStatement = getConnectionSchemaNameCallStatement(); return ExecutorService.getInstance().getExecutor(this). queryForObject(new RawCallStatement(currentSchemaStatement), String.class); } catch (Exception e) { LogFactory.getLogger().info("Error getting default schema", e); } return null; } I just ran this in the debugger and arrived at line: public Object query(final SqlStatement sql, final ResultSetExtractor rse, final List<SqlVisitor> sqlVisitors) throws DatabaseException { if (sql instanceof CallableSqlStatement) { return execute(new QueryCallableStatementCallback(sql, rse), sqlVisitors); } return execute(new QueryStatementCallback(sql, rse, sqlVisitors), sqlVisitors); } As it's instanceof CallableSqlStatement it executes the QueryCallableStatementCallback which throws exception as per below. When I evaluate the execute QueryStatementCallback it succeeds and returns 'dbo' as expected! Error getting default schema {liquibase:133} liquibase.exception.DatabaseException: Error executing SQL select user_name(): Incorrect syntax near the keyword 'select'. at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:88) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:117) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:128) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:136) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:151) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:146) at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:324) at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:305) at liquibase.database.AbstractJdbcDatabase.toString(AbstractJdbcDatabase.java:881) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:117) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:128) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:136) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:151) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:146) at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:324) at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:305) at liquibase.changelog.ChangeLogParameters.<init>(ChangeLogParameters.java:54) at liquibase.Liquibase.<init>(Liquibase.java:104)
    via by Consultant Leon,
  • Unable to update 1.0.3 db?
    via GitHub by ojhunt
    ,
  • GitHub comment 2045#160305523
    via GitHub by yunspace
    ,
    • liquibase.exception.DatabaseException: Error executing SQL select user_name(): Incorrect syntax near the keyword 'select'. at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:88) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:117) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:128) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:136) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:151) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:146) at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:324) at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:305) at liquibase.database.AbstractJdbcDatabase.toString(AbstractJdbcDatabase.java:881) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:117) at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:128) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:136) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:151) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:146) at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:324) at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:305) at liquibase.changelog.ChangeLogParameters.<init>(ChangeLogParameters.java:54) at liquibase.Liquibase.<init>(Liquibase.java:104)

    Users with the same issue

    davidvanlaatum
    1 times, last one,