We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
private void initDBConnection(){ try { conn.setAutoCommit(false); StringBuffer sb = new StringBuffer(); sb.append(" insert into t_mv_owner_x(videoid,kugouid,userid,deleteTime,deleteStatus,selfdirect,"); sb.append(" relation)"); sb.append(" values(?,?,?,?,?,?,?)"); pres = conn.prepareStatement(sb.toString()); } catch (SQLException e1) { log.error("init 3006 DB exception:",e1); } } private void batchInsert(List<MvOwner> Owners) throws SQLException{ for (MvOwner vo : Owners) { pres.setLong(1, vo.getVideoid()); pres.setLong(2, vo.getKugouid()); pres.setLong(3, vo.getUserid()); pres.setInt(4, vo.getDeleteTime()); pres.setInt(5, vo.getDeleteStatus()); pres.setInt(6, vo.getSelfdirect()); pres.setInt(7, vo.getSelfdirect()); pres.addBatch(); } pres.executeBatch(); conn.commit(); pres.clearBatch(); Owners.clear(); } TableRule ownerRule = TableRule.builder("t_mv_owner_x").actualTables(Arrays.asList("t_mv_owner_0", "t_mv_owner_1")).dataSourceRule(dataSourceRule).build(); ShardingRule shardingRule = ShardingRule.builder().dataSourceRule(dataSourceRule).tableRules(Arrays.asList(ownerRule)) .bindingTableRules(Collections.singletonList(new BindingTableRule(Arrays.asList(ownerRule)))) .tableShardingStrategy(new TableShardingStrategy("videoid", new SingleKeyModuloTableShardingAlgorithm())).build(); return new ShardingDataSource(shardingRule);
The text was updated successfully, but these errors were encountered:
1f7ed61
@super11892235 本次修改避免了反复解析SQL。但是如果一次批量执行过多,还是会有oom的风险。原因是sjdbc内部的一些状态也需要进行保留
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: