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

Closed
xindu opened this issue Sep 21, 2017 · 0 comments
Closed

Sybase ASE jConnect JDBC driver support #1777

xindu opened this issue Sep 21, 2017 · 0 comments

Comments

@xindu
Copy link

xindu commented Sep 21, 2017

What version of Flyway are you using?

4.0.2

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?

Linux

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();
flyway.setBaselineOnMigrate(true);
flyway.setDataSource(this.dataSource);
flyway.migrate();

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: java.io.IOException: JZ0SL: Unsupported SQL type 0.

at org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.addAppliedMigration(MetaDataTableImpl.java:242)
at org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.addBaselineMarker(MetaDataTableImpl.java:334)
at org.flywaydb.core.internal.command.DbBaseline$2.call(DbBaseline.java:135)
at org.flywaydb.core.internal.command.DbBaseline$2.call(DbBaseline.java:112)
at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:75)
at org.flywaydb.core.internal.command.DbBaseline.baseline(DbBaseline.java:112)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:990)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:971)
at org.flywaydb.core.Flyway.execute(Flyway.java:1464)
at org.flywaydb.core.Flyway.migrate(Flyway.java:971)
at com.sap.s4idea.cockpit.web.listener.CockpitLifeCycleListener.contextInitialized(CockpitLifeCycleListener.java:33)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:808)

Caused by: java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0SL: Unsupported SQL type 0.
at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(ErrorMessage.java:768)
at com.sybase.jdbc4.jdbc.ErrorMessage.raiseErrorCheckDead(ErrorMessage.java:1181)
at com.sybase.jdbc4.tds.Tds.handleIOE(Tds.java:5247)
at com.sybase.jdbc4.tds.Tds.handleIOE(Tds.java:5192)
at com.sybase.jdbc4.tds.Tds.sendDynamicExecuteParams(Tds.java:1658)
at com.sybase.jdbc4.tds.Tds.dynamicExecute(Tds.java:1458)
at com.sybase.jdbc4.jdbc.SybPreparedStatement.sendQuery(SybPreparedStatement.java:3124)
at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(SybStatement.java:2729)
at com.sybase.jdbc4.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:335)
at sun.reflect.GeneratedMethodAccessor167.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sap.cloud.runtime.kotyo.persistence.client.trace.TraceableBase$1.invoke(TraceableBase.java:44)
at com.sun.proxy.$Proxy34.executeUpdate(Unknown Source)
at com.sap.cloud.runtime.kotyo.persistence.client.trace.TraceablePreparedStatement.executeUpdate(TraceablePreparedStatement.java:88)
at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
at org.flywaydb.core.internal.dbsupport.JdbcTemplate.update(JdbcTemplate.java:304)
at org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.addAppliedMigration(MetaDataTableImpl.java:217)
... 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/flywaydb.org 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
Projects
None yet
Development

No branches or pull requests

2 participants