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.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
How to Build a Custom Oracle Plugin for Nacos 2.2 Using SPI

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: oracle

Reference

https://github.com/pig-mesh/nacos-datasource-plugin-oracle/tree/master/sql

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backend DevelopmentNacosSpring BootOracleDatasource Plugin
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.