alibaba / druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
https://github.com/alibaba/druid/wiki
Apache License 2.0
27.97k stars 8.58k forks source link

connect sybase SQLException: JZ0NK: Generated keys are not available because either the Statement.NO_GENERATED_KEYS #1099

Open gmshiot opened 8 years ago

gmshiot commented 8 years ago

Hello!
When I insert data into table (include identity column),then save data, then get identity column value,throw exception,error below(in fact,com.sybase.jdbc4.jdbc.SybStatement have not function :getGeneratedKeys()): at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.SQLException: JZ0NK: Generated keys are not available because either the Statement.NO_GENERATED_KEYS was used or no keys were automatically generated. at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(Unknown Source) at com.sybase.jdbc4.jdbc.SybStatement.getGeneratedKeys(Unknown Source) at com.alibaba.druid.filter.FilterChainImpl.statement_getGeneratedKeys(FilterChainImpl.java:2621) at com.alibaba.druid.filter.FilterAdapter.statement_getGeneratedKeys(FilterAdapter.java:2524) at com.alibaba.druid.filter.FilterEventAdapter.statement_getGeneratedKeys(FilterEventAdapter.java:415) at com.alibaba.druid.filter.FilterChainImpl.statement_getGeneratedKeys(FilterChainImpl.java:2618) at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.getGeneratedKeys(StatementProxyImpl.java:299)

at com.alibaba.druid.pool.DruidPooledStatement.getGeneratedKeys(DruidPooledStatement.java:599)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:85)
at com.sun.proxy.$Proxy29.getGeneratedKeys(Unknown Source)
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.processBatch(Jdbc3KeyGenerator.java:51)
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.processAfter(Jdbc3KeyGenerator.java:45)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:48)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62)
at com.sun.proxy.$Proxy27.update(Unknown Source)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:48)

at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

... 68 more
wenshao commented 8 years ago

it's sybase jdbc driver exception.