Go to file
fan 75e805be49
Update README.md
2024-09-14 20:46:24 +08:00
.github/workflows [Chore] add ci (#68) 2023-12-27 18:22:45 +08:00
.oceanbase-common initial commit 2022-01-12 14:16:54 +08:00
example [Chore] update README.md (#143) 2024-05-14 21:17:08 +08:00
license-common initial commit 2022-01-12 14:16:54 +08:00
src remove rowKeyElement dependencies test for code review (#159) 2024-09-13 16:22:06 +08:00
.gitignore [Feat] direct load java client 2023-10-11 14:27:20 +08:00
.secignore fix: privacy security 2022-11-21 15:01:43 +08:00
CODE_OF_CONDUCT.md initial commit 2022-01-12 14:16:54 +08:00
CONTRIBUTING.md initial commit 2022-01-12 14:16:54 +08:00
LEGAL.md initial commit 2022-01-12 14:16:54 +08:00
LICENSE initial commit 2022-01-12 14:16:54 +08:00
README.md Update README.md 2024-09-14 20:46:24 +08:00
pom.xml [maven-release-plugin] prepare for next development iteration 2024-09-14 11:00:25 +08:00

README.md

OBKV Table Client

OBKV Table Client is Java Library that can be used to access table data from OceanBase storage layer. Its access method is different from JDBC, it skips the SQL parsing layer, so it has significant performance advantage.

Quick Start

Create table in the OceanBase database:

CREATE TABLE IF NOT EXISTS `test_varchar_table` (
    `c1` varchar(20) NOT NULL,
    `c2` varchar(20) DEFAULT NULL,
    PRIMARY KEY (`c1`)
) PARTITION BY KEY(`c1`) PARTITIONS 10;

Import the dependency for your maven project:

<dependency>
    <groupId>com.oceanbase</groupId>
    <artifactId>obkv-table-client</artifactId>
    <version>1.2.13</version>
</dependency>

The code demo:

    // 1. initail ObTableClient
    ObTableClient obTableClient = new ObTableClient();
    obTableClient.setFullUserName("full_user_name");
    obTableClient.setParamURL("param_url");
    obTableClient.setPassword("password");
    obTableClient.setSysUserName("sys_user_name");
    obTableClient.setSysPassword("sys_user_passwd");
    obTableClient.init();
    
    // set primary key for partition table
    obTableClient.addRowKeyElement("test_varchar_table", new String[]{"c1"});
    
    // 2. single execute
    // return affectedRows
    obTableClient.insert("test_varchar_table", "foo", new String[] { "c2" }, new String[] { "bar" });
    // return Map<String, Object>
    obTableClient.get("test_varchar_table", "foo", new String[] { "c2" });
    // return affectedRows
    obTableClient.delete("test_varchar_table", "foo");

    // 3. batch execute
    TableBatchOps batchOps = obTableClient.batch("test_varchar_table");
    batchOps.insert("foo", new String[] { "c2" }, new String[] { "bar" });
    batchOps.get("foo", new String[] { "c2" });
    batchOps.delete("foo");
    
    List<Object> results = batchOps.execute();
    // the results include 3 item: 1. affectedRows; 2. Map; 3. affectedRows.

NOTE:

  1. param_url is generated by ConfigServer.
  2. More example Demo
  3. full_user_name: the user for accessing obkv, which format is user_name@tenant_name#cluster_name
  4. sys_user_name: root@sys or proxy@sys, which have privileges to access routing system view

Release Notes

Latest release notes could be found in Release notes

Documentation

Licencing

OBKV Table Client is under MulanPSL - 2.0 licence. You can freely copy and use the source code. When you modify or distribute the source code, please obey the MulanPSL - 2.0 licence.

Contributing

Contributions are warmly welcomed and greatly appreciated. Here are a few ways you can contribute:

Support

In case you have any problems when using OceanBase Database, welcome reach out for help: