0
votes

I am trying to execute command on my command prompt:

liquibase --driver=com.mysql.jdbc.Driver --classpath=E:\mysqljar\mysql.jar --changeLogFile=E:\1.xml --url="jdbc:mysql://localhost:3306/abc" --username=root --password=root generateChangeLog

But I am getting this error:

Liquibase Update Failed: Empty result set, expected one row SEVERE 24/9/13 6:29 PM:liquibase: Empty result set, expected one row liquibase.exception.DatabaseException: Error getting jdbc:mysql://localhost:3306/abc view with liquibase.statement.core.GetViewDefinitionStatement@53330681 at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readView(JdbcDatabaseSnapshotGenerator.java:168) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readViews(JdbcDatabaseSnapshotGenerator.java:304) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:241) at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69) at liquibase.diff.Diff.compare(Diff.java:63) at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:145) at liquibase.integration.commandline.Main.doMigration(Main.java:760) at liquibase.integration.commandline.Main.main(Main.java:134) Caused by: liquibase.exception.DatabaseException: Empty result set, expected one row at liquibase.util.JdbcUtils.requiredSingleResult(JdbcUtils.java:124) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:159) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:167) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:163) at liquibase.database.AbstractDatabase.getViewDefinition(AbstractDatabase.java:748) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readView(JdbcDatabaseSnapshotGenerator.java:166) ... 7 more

Could anyone help me to interpret this?

2
It appears to be having a problem getting a view definition. There have been significant improvements to the snapshot/generateChangeLog process in liquibase 3.x. Could you upgrade to 3.0.5+ and see if that helps?Nathan Voxland
I tried using 3.0.5+, but getting same errorpkhauzhal
If you add --logLevel=DEBUG it should output the SQL being ran right before the error, what query is it making?Nathan Voxland

2 Answers

0
votes

I had the same problem.

My fix: There needs to be an entry in the database change log lock table; it needs to have id=1, locked=false and the rest of the values set to null.

-1
votes

I'm getting the same error also using MySQL and tried v3.0.0 and 3.0.5 of liquibase. The error was the same when I tried to do a migrate as well as a generateChangeLog.

./liquibase --logLevel=debug --changeLogFile=./db.changelog-test-v0.1.xml --username=abc --password=abc99 --url="jdbc:mysql://localhost:3306/test" migrate

FYI, here is the select statement that it had trouble executing for the 'migrate' command:

select view_definition from information_schema.views where table_name='patient_info' and table_schema='test'

The information_schema.views table is empty.