一键导入
dbclient-add-engine
Practical guide for adding a new database or middleware engine to DBClient. Use this skill when you need to introduce a new dbType.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Practical guide for adding a new database or middleware engine to DBClient. Use this skill when you need to introduce a new dbType.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Cross-cutting core mechanisms of DBClient: CLI argument parsing, DBConfig, TesterFactory, TestExecutor, and the DatabaseTester interface. Use this skill when modifying generic flows or adding engine registration, validation, or dependencies.
KV / coordination engines in DBClient: Redis, RedisCluster, Redis Sentinel, Camellia-Proxy, Etcd, and Zookeeper. Use this skill when adding, debugging, or modifying such a Tester.
Message-queue engines in DBClient: Kafka, Pulsar, RabbitMQ, and RocketMQ. Use this skill when adding, debugging, or modifying such a Tester.
Relational / JDBC-protocol-compatible engines in DBClient. Covers MySQL-compatible, PostgreSQL-compatible, Oracle, SQLServer, domestic / regulated databases, and analytical databases such as StarRocks, Doris, and ClickHouse. Use this skill when adding, debugging, or modifying such a Tester.
Search / log-retrieval engines in DBClient: Elasticsearch 8.x and OpenSearch. Use this skill when adding, debugging, or modifying such a Tester.
Document / object / graph / big-data storage engines in DBClient: MongoDB, MinIO, Hadoop, Hive, Vault, and Nebula. Use this skill when adding, debugging, or modifying such a Tester.
| name | dbclient-add-engine |
| description | Practical guide for adding a new database or middleware engine to DBClient. Use this skill when you need to introduce a new dbType. |
flowchart LR
A[New dbType] --> B{MySQL protocol?}
B -->|Yes| C[Reuse MySQLTester]
B --> D{PostgreSQL protocol?}
D -->|Yes| E[Reuse PostgreSQLTester]
D -->|No| F{Existing SDK / JDBC / HTTP?}
F -->|JDBC| G[Copy MySQLTester pattern]
F -->|HTTP/REST| H[Copy QdrantTester pattern]
F -->|SDK| I[Copy RedisTester pattern]
If the new engine speaks MySQL or PostgreSQL protocol, you usually only need to register an alias and add the driver dependency.
Example for a MySQL-compatible engine named foomysql:
TesterFactory.java:
case "foomysql":
return new MySQLTester(config);
DBConfig.java whitelist:
case "foomysql":
build.gradle:
implementation 'com.example:foo-mysql-driver:1.0.0'
dbclient-engine-relational/SKILL.md.| Protocol / Client Type | Reference Tester | Why |
|---|---|---|
| JDBC | MySQLTester.java | Clean DatabaseConnection + ResultSet pattern |
| HTTP/REST JSON | QdrantTester.java | Uses Apache HttpClient and Jackson parsing |
| SDK client | RedisTester.java | Pool-based client lifecycle |
| Document store | MongoDBTester.java | Custom QueryResult subclass (MongoDBResult) |
Implement only what you need for the first smoke test, in this order:
connect() + a private DatabaseConnection subclass.execute() + a QueryResult that carries either a ResultSet, raw results, or update count.releaseConnections().executeTest() (just return TestExecutor.executeTest(this, dbConfig)).connectionStress().bench() and executionLoop() only if required.| # | File | Change |
|---|---|---|
| 1 | src/main/java/com/apecloud/dbtester/tester/XxxTester.java | New Tester with DatabaseTester implementation |
| 2 | src/main/java/com/apecloud/dbtester/commons/TesterFactory.java | Add dbType aliases in the switch |
| 3 | src/main/java/com/apecloud/dbtester/commons/DBConfig.java | Add the same aliases to validate() whitelist |
| 4 | build.gradle | Add Maven dependency or local jar |
| 5 | skills/dbclient-engine-*/SKILL.md | Add engine row and dependency note |
Reminder: keep the alias lists in #2 and #3 identical, otherwise config.build() will fail with Unsupported database type.
build.gradle.libs/ and reference it as:
implementation files('libs/xxx-client.jar')
dbclient-engine-storage).shadowJar already excludes signature files and merges service files; verify with:
jar tf build/libs/oneclient-1.0-all.jar | grep -i xxx
# Build
gradle shadowJar
# 1. Query smoke test
java -jar build/libs/oneclient-1.0-all.jar \
-h 127.0.0.1 -P <port> -u <user> -p <pass> -d <db> \
-e xxx -t query -q "<minimal query>"
# 2. Connection stress smoke test
java -jar build/libs/oneclient-1.0-all.jar \
-h 127.0.0.1 -P <port> -u <user> -p <pass> \
-e xxx -t connectionstress -c 50 -s 10
# 3. Benchmark smoke test
java -jar build/libs/oneclient-1.0-all.jar \
-h 127.0.0.1 -P <port> -u <user> -p <pass> -d <db> \
-e xxx -t benchmark -q "<minimal query>" -i 1000 -m 10
If your engine returns something other than a JDBC ResultSet, check whether TestExecutor.formatQueryResult() needs a new branch:
mongodb branchredis branchqdrant branchdbclient-engine-<family> skill.