How to Build a Custom Oracle Plugin for Nacos 2.2 Using SPI
This guide explains how to create a custom Oracle datasource plugin for Nacos 2.2 by adding Maven dependencies, importing the Oracle SQL script, configuring connection properties, and setting the datasource platform, enabling Nacos to use Oracle instead of the default MySQL or Derby.
From version 2.2.0, Nacos can load multiple datasource plugins via SPI and the spring.datasource.platform property.
By default Nacos provides MySQL and Derby implementations; other databases require custom extensions.
Custom Oracle Plugin
1. Add Oracle plugin
Dependencies have been uploaded to Maven Central; do not use Alibaba Cloud proxy.
<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-oracle</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>21.3.0.0</version>
</dependency>2. Import Nacos Oracle SQL script
Download the Nacos Oracle script from: https://github.com/pig-mesh/nacos-datasource-plugin-oracle/tree/master/sql
3. Configure Nacos datasource connection
db:
num: 1
user: PIGX
password: PIGX
url: jdbc:oracle:thin:@172.16.1.198:1521:XE
pool.config.driver-class-name: oracle.jdbc.OracleDriver
pool.config.connection-test-query: 'SELECT 1 FROM DUAL'4. Specify Nacos datasource platform
spring:
datasource:
platform: oracleReference
https://github.com/pig-mesh/nacos-datasource-plugin-oracle/tree/master/sql
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
