最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于sharding-jdbc的使用限制

 更新時(shí)間:2021年10月29日 14:30:27   作者:重度孤獨(dú)癥患者  
這篇文章主要介紹了sharding-jdbc的使用限制,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

使用限制

JDBC未支持列表

  • Sharding-JDBC暫時(shí)未支持不常用的JDBC方法。

DataSource接口

  • 不支持timeout相關(guān)操作

Connection接口

  • 不支持存儲(chǔ)過程,函數(shù),游標(biāo)的操作
  • 不支持執(zhí)行native的SQL
  • 不支持savepoint相關(guān)操作
  • 不支持Schema/Catalog的操作
  • 不支持自定義類型映射

Statement和PreparedStatement接口

  • 不支持返回多結(jié)果集的語句(即存儲(chǔ)過程,非SELECT多條數(shù)據(jù))
  • 不支持國際化字符的操作

對(duì)于ResultSet接口

  • 不支持對(duì)于結(jié)果集指針位置判斷
  • 不支持通過非next方法改變結(jié)果指針位置
  • 不支持修改結(jié)果集內(nèi)容
  • 不支持獲取國際化字符
  • 不支持獲取Array

JDBC 4.1

  • 不支持JDBC 4.1接口新功能
  • 查詢所有未支持方法,請(qǐng)閱讀com.dangdang.ddframe.rdb.sharding.jdbc.unsupported包。

SQL語句限制

  • 不支持DDL語句
  • 不支持子語句
  • 不支持UNION 和 UNION ALL
  • 不支持特殊INSERT
  • 每條INSERT語句只能插入一條數(shù)據(jù),不支持VALUES后有多行數(shù)據(jù)的語句
  • 不支持DISTINCT聚合

shardingjdbc使用及踩坑內(nèi)容

1.使用shardingjdbc做分庫分表

最近公司由于業(yè)務(wù)需要,對(duì)日益增加的數(shù)據(jù)量越來越無法容忍,遂作出分庫分表的決定,考察了幾個(gè)技術(shù)方案后,決定使用shardingsphere做分表中間件。

使用maven拉取jar包:

    <dependency>
       <groupId>io.shardingsphere</groupId>
       <artifactId>sharding-jdbc</artifactId>
       <version>3.0.0.M3</version>
      </dependency>
      <dependency>
       <groupId>io.shardingsphere</groupId>
       <artifactId>sharding-jdbc-spring-namespace</artifactId>
       <version>3.0.0.M3</version>
      </dependency>

分表配置:

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:sharding="http://shardingsphere.io/schema/shardingsphere/sharding"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
  http://shardingsphere.io/schema/shardingsphere/sharding
       http://shardingsphere.io/schema/shardingsphere/sharding/sharding.xsd"
    default-autowire="byName">
    
 <!-- 分表算法 -->
 <bean id="tableShardingAlgorithm" class="pxf.commom.support.sharding.tableShardingAlgorithm" />
 <sharding:complex-strategy id="tableStrategy"
          sharding-columns="uid"
          algorithm-ref="tableShardingAlgorithm" />
 <!-- ds_0為數(shù)據(jù)源,如果做分庫,可配置多個(gè)數(shù)據(jù)源;不分表的表不用在此做配置-->
 <sharding:data-source id="dataSource">
  <sharding:sharding-rule data-source-names="ds_0" default-data-source-name="ds_0" >
   <sharding:table-rules>
    <sharding:table-rule
      logic-table="test_table"
      actual-data-nodes="ds_0.test_table_$->{0..128}"
      table-strategy-ref="tableStrategy" />
   </sharding:table-rules>
  </sharding:sharding-rule>
 </sharding:data-source>
</beans>

2.踩坑內(nèi)容

1). 用于分表的列在sql中不能為空,所以像insert之類的語句需要做下非空判斷;

2). sqlmap中LONGVARCHER字段不能使用,會(huì)報(bào)序列化異常,可改為VARCHAR類型;

3). union語法不支持,可改為OR查詢(shardingjdbc連OR也不支持,所以建議使用shardingsphere)。

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

西丰县| 方城县| 当阳市| 内乡县| 盘山县| 资源县| 清苑县| 潍坊市| 来凤县| 民勤县| 山东| 崇明县| 临高县| 筠连县| 中阳县| 崇礼县| 颍上县| 蚌埠市| 乐昌市| 日喀则市| 克山县| 平舆县| 昭平县| 洛川县| 鄯善县| 遵义县| 宣威市| 永城市| 浦江县| 永靖县| 高要市| 共和县| 威宁| 固始县| 漠河县| 沐川县| 乾安县| 剑河县| 正镶白旗| 安图县| 齐河县|