You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/03/01 09:51:47 UTC

[GitHub] [shardingsphere] onevroad opened a new issue #15689: Cannot batch insert in Oracle

onevroad opened a new issue #15689:
URL: https://github.com/apache/shardingsphere/issues/15689


   ## Bug Report
   
   When i use the sharding-jdbc to batch insert sql in Oracle ,it gives me a exception.
   But MySQL is OK.
   
   ### Which version of ShardingSphere did you use?
   
   sharding 5.1.0
   java 1.8
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   ### Actual behavior
   
   My sql is:
   ` INSERT ALL     INTO  demo_sharding   ( id,name,content,remark,creator_id,create_time,updator_id,update_time,flag )   VALUES  ( ?,?,?,?,?,?,?,?,? )    SELECT 1 FROM DUAL`
   
   the Exception is :
   
   ```
   ### Error updating database.  Cause: java.lang.NullPointerException
   ### The error may involve demo.data.mapper.DemoShardingMapper.insertBatch-Inline
   ### The error occurred while setting parameters
   ### SQL: INSERT ALL     INTO  demo_sharding   ( id,name,content,remark,creator_id,create_time,updator_id,update_time,flag )   VALUES  ( ?,?,?,?,?,?,?,?,? )    SELECT 1 FROM DUAL
   ### Cause: java.lang.NullPointerException
   	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
   	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.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
   	... 7 more
   Caused by: java.lang.NullPointerException
   	at org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext.<init>(InsertStatementContext.java:82)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:142)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:116)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createLogicSQL(ShardingSpherePreparedStatement.java:438)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:331)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
   	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
   	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
   	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
   	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
   	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.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
   	at com.sun.proxy.$Proxy257.update(Unknown Source)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
   	... 13 more
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #15689: Cannot batch insert in Oracle

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #15689:
URL: https://github.com/apache/shardingsphere/issues/15689#issuecomment-1060350183


   @onevroad Thank you for your feedback, we will fix this bug.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] onevroad commented on issue #15689: Cannot batch insert in Oracle

Posted by GitBox <gi...@apache.org>.
onevroad commented on issue #15689:
URL: https://github.com/apache/shardingsphere/issues/15689#issuecomment-1060319899


   Is there any way to fix it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] cheese8 commented on issue #15689: Cannot batch insert in Oracle

Posted by GitBox <gi...@apache.org>.
cheese8 commented on issue #15689:
URL: https://github.com/apache/shardingsphere/issues/15689#issuecomment-1064671175


   I will take a look.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #15689: Cannot batch insert in Oracle

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #15689:
URL: https://github.com/apache/shardingsphere/issues/15689#issuecomment-1060361861


   Can you show your sharding configuration?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] onevroad commented on issue #15689: Cannot batch insert in Oracle

Posted by GitBox <gi...@apache.org>.
onevroad commented on issue #15689:
URL: https://github.com/apache/shardingsphere/issues/15689#issuecomment-1062608102


   ```properties
   spring.shardingsphere.datasource.names=ds0,ds1
   
   spring.shardingsphere.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.ds0.driver-class-name=oracle.jdbc.OracleDriver
   spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
   spring.shardingsphere.datasource.ds0.username=demo
   spring.shardingsphere.datasource.ds0.password=123456
   
   spring.shardingsphere.datasource.ds1.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.ds1.driver-class-name=oracle.jdbc.OracleDriver
   spring.shardingsphere.datasource.ds1.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1522:orcl
   spring.shardingsphere.datasource.ds1.username=demo
   spring.shardingsphere.datasource.ds1.password=123456
   
   spring.shardingsphere.rules.readwrite-splitting.data-sources.ds.type=Static
   spring.shardingsphere.rules.readwrite-splitting.data-sources.ds.props.write-data-source-name=ds0
   spring.shardingsphere.rules.readwrite-splitting.data-sources.ds.props.read-data-source-names=ds1
   spring.shardingsphere.rules.readwrite-splitting.data-sources.ds.load-balancer-name=round-robin
   spring.shardingsphere.rules.readwrite-splitting.load-balancers.round-robin.type=ROUND_ROBIN
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org