foxysoft / idm-connector-bobj

SAP Identity Management connector for SAP BusinessObjects BI Platform
Apache License 2.0
5 stars 2 forks source link

fx_getSchemaVersion fails on Sybase ASE #9

Closed boskamp closed 5 years ago

boskamp commented 5 years ago
fx_getSchemaVersion: java.sql.SQLException: JZ004: User name property missing in DriverManager.getConnection(..., Properties).
    at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(ErrorMessage.java:768)
    at com.sybase.jdbc4.tds.LoginToken.<init>(LoginToken.java:157)
    at com.sybase.jdbc4.tds.Tds.doLogin(Tds.java:666)
    at com.sybase.jdbc4.tds.Tds.login(Tds.java:579)
    at com.sybase.jdbc4.jdbc.SybConnection.tryLogin(SybConnection.java:422)
    at com.sybase.jdbc4.jdbc.SybConnection.handleHAFailover(SybConnection.java:3335)
    at com.sybase.jdbc4.jdbc.SybConnection.<init>(SybConnection.java:348)
    at com.sybase.jdbc4.jdbc.SybConnection.<init>(SybConnection.java:253)
    at com.sybase.jdbc4.jdbc.SybDriver.connect(SybDriver.java:232)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:270)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:228)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
    at org.mozilla.javascript.gen.c66.call(fx_trace:114)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
    at org.mozilla.javascript.gen.c68.call(fx_trace:222)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
    at org.mozilla.javascript.gen.c71.call(fx_trace:247)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
    at org.mozilla.javascript.gen.c74.call(fx_IDSID:30)
    at com.sap.idm.ic.RunScript.execute(RunScript.java:175)
    at com.sap.idm.ic.RunScript.runFunctionsInString(RunScript.java:395)
    at com.sap.idm.ic.ToPass.processRules(ToPass.java:486)
    at com.sap.idm.ic.ToPass.putNextEntry(ToPass.java:780)
    at com.sap.idm.ic.ToODBC.putNextEntry(ToODBC.java:40)
    at com.sap.idm.ic.ToPass.putNextEntry(ToPass.java:733)
    at com.sap.idm.ic.ToODBC.putNextEntry(ToODBC.java:40)
    at com.sap.idm.ic.DSERunTime.runToPass(DSERunTime.java:2653)
    at com.sap.idm.ic.DSERunTime.runPass(DSERunTime.java:3137)
    at com.sap.idm.ic.DSERunTime.runJob(DSERunTime.java:1264)
    at com.sap.idm.ic.DSERunTime.loopJob(DSERunTime.java:667)
    at com.sap.idm.ic.DSERunTime.doCommand(DSERunTime.java:1888)
    at com.sap.idm.ic.DSERunTime.doCommand(DSERunTime.java:333)
    at com.sap.idm.ic.DSERunTime.run(DSERunTime.java:3526)
    at com.sap.idm.ic.DSERunTime.main(DSERunTime.java:3449)
boskamp commented 5 years ago

It seems this is a general issue with using JDBC URLs, as stored by SAP Identity Management, to obtain a JDBC connection object. For Sybase, the format internally stored by SAP IDM always ends in

!!!user=<user>;password=<password>

The documentation of Sybase JDBC, however, does not specify such a syntax, specifically not the three exclamation marks. Hence, it seems SAP IDM is parsing that syntax internally into three parts: vendor JDBC URL, login user and login password. If the SAP IDM-specific syntax addition exists, SAP IDM will then call java.sql.DriverManager.getConnection(String url, String user, String password) with the parsed elements, instead of handing over to the single-argument method directly.

This seems to work with all drivers and URL formats, not only Sybase. Tested in SAP IDM 8.0 SP5 with Oracle.

boskamp commented 5 years ago

Parsing the JDBC URL correctly is required, but not sufficient. Here's the follow-up issue that will occur next:

fx_getSchemaVersion: com.sybase.jdbc4.jdbc.SybSQLException: Procedure mc_schemaversion expects parameter @Schemaversion, which was not supplied.at com.sybase.jdbc4.tds.Tds.processEed(Tds.java:4084)
    at com.sybase.jdbc4.tds.Tds.nextResult(Tds.java:3174)
    at com.sybase.jdbc4.jdbc.ResultGetter.nextResult(ResultGetter.java:78)
    at com.sybase.jdbc4.jdbc.SybStatement.nextResult(SybStatement.java:289)
    at com.sybase.jdbc4.jdbc.SybStatement.nextResult(SybStatement.java:271)
    at com.sybase.jdbc4.jdbc.SybStatement.executeLoop(SybStatement.java:2593)
    at com.sybase.jdbc4.jdbc.SybCallableStatement.execute(SybCallableStatement.java:217)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:228)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
    at org.mozilla.javascript.gen.c66.call(fx_trace:138)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
    at org.mozilla.javascript.gen.c69.call(fx_trace:265)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
    at org.mozilla.javascript.gen.c72.call(fx_trace:290)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
    at org.mozilla.javascript.gen.c75.call(fx_IDSID:30)
    at com.sap.idm.ic.RunScript.execute(RunScript.java:175)
    at com.sap.idm.ic.RunScript.runFunctionsInString(RunScript.java:395)
    at com.sap.idm.ic.ToPass.processRules(ToPass.java:486)
    at com.sap.idm.ic.ToPass.putNextEntry(ToPass.java:780)
    at com.sap.idm.ic.ToODBC.putNextEntry(ToODBC.java:40)
    at com.sap.idm.ic.ToPass.putNextEntry(ToPass.java:733)
    at com.sap.idm.ic.ToODBC.putNextEntry(ToODBC.java:40)
    at com.sap.idm.ic.DSERunTime.runToPass(DSERunTime.java:2653)
    at com.sap.idm.ic.DSERunTime.runPass(DSERunTime.java:3137)
    at com.sap.idm.ic.DSERunTime.runJob(DSERunTime.java:1264)
    at com.sap.idm.ic.DSERunTime.loopJob(DSERunTime.java:667)
    at com.sap.idm.ic.DSERunTime.doCommand(DSERunTime.java:1888)
    at com.sap.idm.ic.DSERunTime.doCommand(DSERunTime.java:333)
    at com.sap.idm.ic.DSERunTime.run(DSERunTime.java:3526)
    at com.sap.idm.ic.DSERunTime.main(DSERunTime.java:3449)

Solution: replace named arguments with positional arguments in procedure call

boskamp commented 5 years ago

Fixed by b9de5567585aadb2cf433802bcc8a6bc8e8ffb77