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

Jdbc support error #400

Closed
zhegexiaohuozi opened this issue Mar 27, 2017 · 0 comments
Closed

Jdbc support error #400

zhegexiaohuozi opened this issue Mar 27, 2017 · 0 comments

Comments

@zhegexiaohuozi
Copy link

zhegexiaohuozi commented Mar 27, 2017

@allwefantasy I excute the sql SELECT user_id,sum(amt) as sum_amt from index1/type2 GROUP BY user_id HAVING sum_amt < 500 ORDER BY uid desc limit 100,5,and found that the condition HAVING sum_amt < 500(or sum(amt) < 500) did not produce any results. Also the condition limit 100,5 did not produce any results.
If excute the following sql SELECT * FROM (SELECT user_id,sum(amt) as sum_amt from index1/type2 GROUP BY user_id) as a WHERE a.sum_amt < 500 ORDER BY a.uid desc limit 100,5

And I get the Exception:

Exception in thread "main" java.sql.SQLException: Error
	at com.alibaba.druid.pool.ElasticSearchDruidDataSource.handleConnectionException(ElasticSearchDruidDataSource.java:1109)
	at com.alibaba.druid.pool.DruidPooledConnection.handleException(DruidPooledConnection.java:127)
	at com.alibaba.druid.pool.DruidPooledStatement.checkException(DruidPooledStatement.java:68)
	at com.alibaba.druid.pool.ElasticSearchDruidPooledPreparedStatement.executeQuery(ElasticSearchDruidPooledPreparedStatement.java:61)
	at com.xx.test.test.Elastic.jdbc(Elastic.java:79)
	at com.xx.test.test.Elastic.main(Elastic.java:94)
	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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassCastException: com.alibaba.druid.sql.ast.statement.SQLSubqueryTableSource cannot be cast to com.alibaba.druid.sql.ast.statement.SQLJoinTableSource
	at org.nlpcn.es4sql.parse.SqlParser.findFrom(SqlParser.java:227)
	at org.nlpcn.es4sql.parse.SqlParser.parseSelect(SqlParser.java:48)
	at org.nlpcn.es4sql.parse.SqlParser.parseSelect(SqlParser.java:35)
	at org.nlpcn.es4sql.query.ESActionFactory.create(ESActionFactory.java:61)
	at org.nlpcn.es4sql.SearchDao.explain(SearchDao.java:46)
	at com.alibaba.druid.pool.ElasticSearchDruidPooledPreparedStatement.getObjectResult(ElasticSearchDruidPooledPreparedStatement.java:72)
	at com.alibaba.druid.pool.ElasticSearchDruidPooledPreparedStatement.executeQuery(ElasticSearchDruidPooledPreparedStatement.java:46)
	... 7 more

druid version

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.0.16</version>
        </dependency>

If use higher version than 1.0.16 ,will get exception

Exception in thread "main" java.lang.NoSuchMethodError: com.alibaba.druid.pool.DruidConnectionHolder.<init>(Lcom/alibaba/druid/pool/DruidAbstractDataSource;Ljava/sql/Connection;)V
	at com.alibaba.druid.pool.ElasticSearchDruidDataSource.init(ElasticSearchDruidDataSource.java:571)
	at com.alibaba.druid.pool.ElasticSearchDruidDataSource.getConnection(ElasticSearchDruidDataSource.java:897)
	at com.alibaba.druid.pool.ElasticSearchDruidDataSource.getConnection(ElasticSearchDruidDataSource.java:893)
	at com.xx.test.test.Elastic.jdbc(Elastic.java:77)
	at com.xx.test.test.Elastic.main(Elastic.java:95)
	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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant