java.sql.SQLException

Could not perform raw query for SELECT sensorVariableId, MIN(min) AS min, MAX(max) AS max, SUM(avg*samples)/SUM(samples) AS avg, SUM(samples) AS samples, 1484940146167 AS timestamp FROM metrics_double_type_device WHERE sensorVariableId=2,827 AND timestamp > 1484940086167 AND timestamp <= 1484940146167 GROUP BY sensorVariableId

Samebug tips1

Check if you're not creating unused SQL entities, as it might cause this exception.


rafaelrafael

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web840

  • via GitHub by Redferne
    ,
  • via Stack Overflow by Alex
    ,
  • Stack trace

    • java.sql.SQLException: Could not perform raw query for SELECT sensorVariableId, MIN(min) AS min, MAX(max) AS max, SUM(avg*samples)/SUM(samples) AS avg, SUM(samples) AS samples, 1484940146167 AS timestamp FROM metrics_double_type_device WHERE sensorVariableId=2,827 AND timestamp > 1484940086167 AND timestamp <= 1484940146167 GROUP BY sensorVariableId at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:25) at com.j256.ormlite.dao.BaseDaoImpl.queryRaw(BaseDaoImpl.java:629) at org.mycontroller.standalone.api.MetricApi.getSensorVariableMetricsDouble(MetricApi.java:145) at org.mycontroller.standalone.api.jaxrs.MetricsHandler.getMetricsDataJsonNVD3(MetricsHandler.java:824) at org.mycontroller.standalone.api.jaxrs.MetricsHandler.getMetricsNvd3Data(MetricsHandler.java:134) at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328) at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282) at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054) at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402) at java.lang.Thread.run(Thread.java:745) Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT SENSORVARIABLEID, MIN(MIN) AS MIN, MAX(MAX) AS MAX, SUM(AVG*SAMPLES)/SUM(SAMPLES) AS AVG, SUM(SAMPLES) AS SAMPLES, 1484940146167 AS TIMESTAMP FROM METRICS_DOUBLE_TYPE_DEVICE WHERE SENSORVARIABLEID=2,[*]827 AND TIMESTAMP > 1484940086167 AND TIMESTAMP <= 1484940146167 GROUP BY SENSORVARIABLEID "; SQL statement: SELECT sensorVariableId, MIN(min) AS min, MAX(max) AS max, SUM(avg*samples)/SUM(samples) AS avg, SUM(samples) AS samples, 1484940146167 AS timestamp FROM metrics_double_type_device WHERE sensorVariableId=2,827 AND timestamp > 1484940086167 AND timestamp <= 1484940146167 GROUP BY sensorVariableId [42000-176] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) at org.h2.message.DbException.get(DbException.java:178) at org.h2.message.DbException.get(DbException.java:154) at org.h2.message.DbException.getSyntaxError(DbException.java:190) at org.h2.command.Parser.getSyntaxError(Parser.java:517) at org.h2.command.Parser.prepareCommand(Parser.java:246) at org.h2.engine.Session.prepareLocal(Session.java:442) at org.h2.engine.Session.prepareCommand(Session.java:384) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188) at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73) at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:665) at com.j256.ormlite.jdbc.JdbcDatabaseConnection.compileStatement(JdbcDatabaseConnection.java:141) at com.j256.ormlite.stmt.StatementExecutor.queryRaw(StatementExecutor.java:302) at com.j256.ormlite.dao.BaseDaoImpl.queryRaw(BaseDaoImpl.java:627) ... 22 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    aidoanaidoan
    6 times, last one
    tvrmsmithtvrmsmith
    20 times, last one
    batwalrus76batwalrus76
    4 times, last one
    HandemelindoHandemelindo
    Once,
    rocdayrocday
    3 times, last one
    145 more bugmates