Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sybase ASE jConnect JDBC driver support #1777

xindu opened this issue Sep 21, 2017 · 0 comments

Sybase ASE jConnect JDBC driver support #1777

xindu opened this issue Sep 21, 2017 · 0 comments


Copy link

xindu commented Sep 21, 2017

What version of Flyway are you using?


Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Java API

What database are you using (type & version)?

SAP ASE 16.0.02
JDBC Version: jConn4

What operating system are you using?


What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
Here is the typical Java code I am using for Flyway:
Flyway flyway = new Flyway();

There is an exception when the Flyway execute the baseline migration:
Unable to insert row for version '1' in metadata table schema_version

SQL State : JZ006
Error Code : 0
Message : JZ006: Caught IOException: JZ0SL: Unsupported SQL type 0.

at org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.addAppliedMigration(
at org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.addBaselineMarker(
at org.flywaydb.core.internal.command.DbBaseline$
at org.flywaydb.core.internal.command.DbBaseline$
at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(
at org.flywaydb.core.internal.command.DbBaseline.baseline(
at org.flywaydb.core.Flyway$1.execute(
at org.flywaydb.core.Flyway$1.execute(
at org.flywaydb.core.Flyway.execute(
at org.flywaydb.core.Flyway.migrate(
at org.apache.catalina.core.StandardContext.listenerStart(
at org.apache.catalina.core.StandardContext.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(
at org.apache.catalina.startup.HostConfig.deployWAR(
at org.apache.catalina.startup.HostConfig$
at java.util.concurrent.Executors$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

Caused by: java.sql.SQLException: JZ006: Caught IOException: JZ0SL: Unsupported SQL type 0.
at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(
at com.sybase.jdbc4.jdbc.ErrorMessage.raiseErrorCheckDead(
at com.sybase.jdbc4.tds.Tds.handleIOE(
at com.sybase.jdbc4.tds.Tds.handleIOE(
at com.sybase.jdbc4.tds.Tds.sendDynamicExecuteParams(
at com.sybase.jdbc4.tds.Tds.dynamicExecute(
at com.sybase.jdbc4.jdbc.SybPreparedStatement.sendQuery(
at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(
at com.sybase.jdbc4.jdbc.SybPreparedStatement.executeUpdate(
at sun.reflect.GeneratedMethodAccessor167.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.sun.proxy.$Proxy34.executeUpdate(Unknown Source)
at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(
at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(
at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(
at org.flywaydb.core.internal.dbsupport.JdbcTemplate.update(
at org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.addAppliedMigration(
... 23 common frames omitted

As I debugged the code, the error is caused by following code in JdbcTemplate of Flyway library:
private PreparedStatement prepareStatement(String sql, Object[] params) throws SQLException {
PreparedStatement statement = connection.prepareStatement(sql);
for (int i = 0; i < params.length; i++) {
if (params[i] == null) {
statement.setNull(i + 1, nullType); // this line causes the error when the checksum is a null integer. It seems Sybase connector doesn't know the null type.
} else if (params[i] instanceof Integer) {
statement.setInt(i + 1, (Integer) params[i]);
} else if (params[i] instanceof Boolean) {
statement.setBoolean(i + 1, (Boolean) params[i]);
} else {
statement.setString(i + 1, (String) params[i]);
return statement;

As I see it, it should be the problem of the Sybase jConnect, however, the Flyway library should be robust enough to handle such situations because it may happen on any database which doesn't support the java.sql.Types.

What did you expect to see?

No exception is thrown for Sybase.

What did you see instead?
@axelfontaine axelfontaine added this to the Flyway 5.0.0 milestone Sep 22, 2017
@axelfontaine axelfontaine changed the title Flyway 4.2.0 doesn't work with SAP ASE 16 via jconn4 Add support Sybase ASE jConnect JDBC driver Nov 14, 2017
@axelfontaine axelfontaine changed the title Add support Sybase ASE jConnect JDBC driver Sybase ASE jConnect JDBC driver support Nov 14, 2017
axelfontaine pushed a commit to flyway/ that referenced this issue Nov 14, 2017
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants