SQLException "JZ0SB: Parameter index out of range: 1." while executing Liquibase on Sybase

StackOverflow https://stackoverflow.com/questions/23130013

  •  05-07-2023
  •  | 
  •  

Domanda

I try to deploy database changes on a local Sybase ASE with a maven build using Liquibase. The build fails with the SQLException JZ0SB: Parameter index out of range: 1.(in maven output the error message is in german)

The maven output(-X -e) is as following:

[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

The settings are shown in the maven log too. Here is the liquibase-maven plugin config from the pom:

        <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>

The error occurs while liquibase tries to drop the lock table. Setting the dropFirst property to false does not resolve the error but let it pop up somewhere else.

Does liquibase need some more configuration to use Sybase ASE or do I have an error in the configuration I don't see? Maybe it is a liquibase bug?

Thanks for your help.

È stato utile?

Soluzione

Liquibase is simply making a call to the JDBC driver's getMetaData().getSchema() method, so it looks like more like a JDBC driver issue. Are you using the newest version and/or a version that is certified with your version of Sybase?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top