Databases 4 min read

How to Add a Shentong Database Plugin to Nacos 2.2+

This guide explains how to create and configure a custom Shentong datasource plugin for Nacos 2.2+, covering dependency addition, script conversion, connection settings, and platform specification to enable Shentong as a supported database.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
How to Add a Shentong Database Plugin to Nacos 2.2+

Background

Nacos supports injecting multiple data sources via the SPI mechanism starting from version 2.2.0; after adding the corresponding data source implementation, the plugin can be selected at startup by setting spring.datasource.platform in application.properties.

"Nacos officially provides default implementations for MySQL and Derby; other database types require custom extensions."

Custom Shentong Plugin

1. Add Shentong Plugin

"Dependencies have been uploaded to Maven Central; do not use Alibaba Cloud proxy."
<dependency>
  <groupId>com.pig4cloud.plugin</groupId>
  <artifactId>nacos-datasource-plugin-shentong</artifactId>
  <version>0.0.1</version>
</dependency>

<dependency>
  <groupId>com.stdb</groupId>
  <artifactId>stoscarJDBC</artifactId>
  <version>16</version>
  <scope>system</scope>
  <systemPath>/Users/lengleng/Downloads/oscarJDBC16.jar</systemPath>
</dependency>

2. Obtain Shentong Database Scripts

Use the Shentong database migration tool to accurately convert the MySQL scripts provided by Nacos into Shentong database and object storage formats.

3. Configure Nacos Data Source Connection

db:
  num: 1
  user: SYSDBA
  password: szoscar55
  url: jdbc:oscar://172.16.1.200:2003/OSRDB?currentSchema=PIG_CONFIG
  pool.config.driver-class-name: com.oscar.Driver
  pool.config.connection-test-query: 'SELECT 1 FROM DUAL'

4. Specify Nacos Data Source Platform

spring:
  datasource:
    platform: shentong

Source code address: https://github.com/pig-mesh/nacos-datasource-plugin-shentong

References

Source code address: https://github.com/pig-mesh/nacos-datasource-plugin-shentong

NacosSPIDatasource PluginShentong
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.