我尝试使用Liquibase在maven版本的本地Sybase ASE上部署数据库更改。
构建失败,带有SQLException JZ0SB: Parameter index out of range: 1.
(在maven输出中,错误消息是德语)
maven输出(-X -e)如下:
[INFO] ------------------------------------------------------------------------
[INFO] Settings----------------------------
[INFO] driver: com.sybase.jdbc4.jdbc.SybDriver
[INFO] url: jdbc:sybase:Tds:localhost:5000
[INFO] username: csidbo
[INFO] password: *****
[INFO] use empty password: false
[INFO] properties file: null
[INFO] properties file will override? false
[INFO] prompt on non-local database? true
[INFO] clear checksums? false
[INFO] changeLogFile: src/main/resources/sql/install/install-1.0.12-SNAPSHOT.xml
[INFO] context(s): null
[INFO] number of changes to apply: 0
[INFO] drop first? true
[INFO] ------------------------------------------------------------------------
[DEBUG] expressionVars = null
[DEBUG] expressionVariables = null
[INFO] Executing on Database: jdbc:sybase:Tds:localhost:5000
INFO 17.04.14 11:42:liquibase: Successfully released change log lock
SEVERE 17.04.14 11:42:liquibase: Unable to release lock: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.250s
[INFO] Finished at: Thu Apr 17 11:42:12 CEST 2014
[INFO] Final Memory: 17M/311M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.1:update (default) on project test: Error setting up or running Liquibase: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.1:update (default) on project test: Error setting up or running Liquibase: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error setting up or running Liquibase: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1.
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:381)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1.
at liquibase.Liquibase.dropAll(Liquibase.java:685)
at liquibase.Liquibase.dropAll(Liquibase.java:665)
at org.liquibase.maven.plugins.LiquibaseUpdate.doUpdate(LiquibaseUpdate.java:25)
at org.liquibase.maven.plugins.AbstractLiquibaseUpdateMojo.performLiquibaseTask(AbstractLiquibaseUpdateMojo.java:24)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:377)
... 21 more
Caused by: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1.
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:209)
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:148)
at liquibase.Liquibase.dropAll(Liquibase.java:673)
... 25 more
Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1.
at liquibase.lockservice.StandardLockService.hasDatabaseChangeLogLockTable(StandardLockService.java:136)
at liquibase.lockservice.StandardLockService.init(StandardLockService.java:80)
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:182)
... 27 more
Caused by: liquibase.exception.DatabaseException: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1.
at liquibase.snapshot.jvm.SchemaSnapshotGenerator.snapshotObject(SchemaSnapshotGenerator.java:87)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:59)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:131)
at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:36)
at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:24)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:129)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:122)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:110)
at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:100)
at liquibase.snapshot.SnapshotGeneratorFactory.hasDatabaseChangeLogLockTable(SnapshotGeneratorFactory.java:169)
at liquibase.lockservice.StandardLockService.hasDatabaseChangeLogLockTable(StandardLockService.java:134)
... 29 more
Caused by: java.sql.SQLException: JZ0SB: Anzahl der Parameter ist au?erhalb des g?ltigen Bereichs: 1.
at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc4.jdbc.ParamManager.int(Unknown Source)
at com.sybase.jdbc4.jdbc.ParamManager.doSetParam(Unknown Source)
at com.sybase.jdbc4.jdbc.ParamManager.setParam(Unknown Source)
at com.sybase.jdbc4.jdbc.SybPreparedStatement.a(Unknown Source)
at com.sybase.jdbc4.jdbc.SybPreparedStatement.a(Unknown Source)
at com.sybase.jdbc4.jdbc.SybPreparedStatement.setNull(Unknown Source)
at com.sybase.jdbc4.jdbc.SybDatabaseMetaData.a(Unknown Source)
at com.sybase.jdbc4.jdbc.SybDatabaseMetaData.getSchemas(Unknown Source)
at liquibase.snapshot.jvm.SchemaSnapshotGenerator.snapshotObject(SchemaSnapshotGenerator.java:65)
... 46 more
设置也显示在maven日志中。这是来自pom的liquibase-maven插件配置:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<!-- <propertyFile>src/main/resources/sql/liquibase.properties</propertyFile> -->
<changeLogFile>${liquibase.changeLogFile}</changeLogFile>
<driver>${liquibase.driver}</driver>
<url>${liquibase.url}</url>
<username>${liquibase.user}</username>
<password>${liquibase.password}</password>
<defaultSchemaName>${liquibase.schema}</defaultSchemaName>
<verbose>true</verbose>
<migrationSqlOutputFile>${liquibase.sqlOutputFile}</migrationSqlOutputFile>
<dropFirst>${liquibase.dropFirst}</dropFirst>
<promptOnNonLocalDatabase>${liquibase.promptOnNonLocalDB}</promptOnNonLocalDatabase>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>${liquibase.mavenGoal}</goal>
</goals>
</execution>
</executions>
</plugin>
liquibase尝试删除锁定表时发生错误。将dropFirst属性设置为false不会解决错误,但会让它弹出其他位置。
liquibase是否需要更多配置才能使用Sybase ASE,或者我在配置中遇到错误?也许这是一个liquibase bug?
感谢您的帮助。
答案 0 :(得分:0)
Liquibase只是调用JDBC驱动程序的getMetaData()。getSchema()方法,因此看起来更像是JDBC驱动程序问题。您使用的是最新版本和/或经过Sybase版本认证的版本吗?