Description:
SELECT TOP expression without parenthesis is deprecated and not supported from MS SQL server 2005 onwards [1][2] Correct way to do this is by including the number within parenthesis.
Eg: DELETE TOP (%d) FROM IDN_AUTH_SESSION_STORE WHERE TIME_CREATED < ? AND TENANT_ID = ?
Need to modify SQL queries with TOP expressions to include parenthesis around the expression value.
[1] https://social.msdn.microsoft.com/Forums/sqlserver/en-US/a20c68c0-6c20-4be4-9059-295d1e639f55/why-is-the-select-top-expression-without-parentheses-not-recommended-post-sql-2000?forum=transactsql
[2] http://www.dotnetfunda.com/articles/show/59/difference-between-top-clause-in-sql-2000-and-sql-2005
Suggested Labels:
Bug,identity-framework
Suggested Assignees:
Affected Product Version:
IS 5.3.0 WUM updated pack
OS, DB, other environment details and versions:
MS SQL server
Steps to reproduce:
Set up WSO2 IS with MS SQL server
Configure session data clean up task as follows in identity.xml file
<SessionDataCleanUp>
<Enable>true</Enable>
<CleanUpTimeout>2</CleanUpTimeout>
<CleanUpPeriod>4</CleanUpPeriod>
</SessionDataCleanUp>
Restart the server.
When the clean up task runs following error logged in the console.
TID: [-1] [] [2017-12-13 13:59:45,581] ERROR {org.wso2.carbon.identity.application.authentication.framework.store.SessionDataStore} - Error while removing session data from the database for nano time 1511960385327480568
com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '50000'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:258)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1535)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:467)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:409)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7151)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2478)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:219)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:199)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:356)
at sun.reflect.GeneratedMethodAccessor136.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
at com.sun.proxy.$Proxy22.executeUpdate(Unknown Source)
at org.wso2.carbon.identity.application.authentication.framework.store.SessionDataStore.removeExpiredRememberMeSessions(SessionDataStore.java:435)
at org.wso2.carbon.identity.application.authentication.framework.store.SessionDataStore.removeExpiredRememberMeSessions(SessionDataStore.java:387)
at org.wso2.carbon.identity.application.authentication.framework.store.SessionDataStore.removeExpiredSessionData(SessionDataStore.java:463)
at org.wso2.carbon.identity.application.authentication.framework.store.SessionCleanUpService$DatabaseCleanUpTask.run(SessionCleanUpService.java:71)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Related Issues: