How to Compile Nacos with Oracle Support and Run It in Standalone Mode
Learn how to extend Nacos’s configuration persistence beyond Derby and MySQL by cloning the feature_multiple_datasource_support branch, compiling the source with Maven, configuring Oracle as a datasource in application.properties, and launching Nacos in standalone mode, with step‑by‑step commands and essential scripts.
Currently Nacos provides configuration persistence using Derby and MySQL. In scenarios where these databases cannot be used, you need to extend support for other databases manually. Nacos previously created a branch to adapt other databases, which can be obtained by compiling the source.
Getting Source Code and Building
Clone the branch that supports multiple data sources.
<code>git clone https://github.com/alibaba/nacos.git -b feature_multiple_datasource_support</code>Build the executable.
<code>mvn -B clean package -Dmaven.test.skip=true -Prelease-nacos</code>After compilation, the file nacos-server-1.4.2-SNAPSHOT.zip is generated in nacos/distribution/target .
Running Nacos
Obtain the database initialization scripts; after extracting, they can be found in the
confdirectory.
Edit
bin/application.propertiesto add Oracle or other datasource information.
<code>## jpa
spring.data.jpa.repositories.enabled=true
spring.jpa.show-sql=true
## The datasource is used by oracle
spring.jpa.hibernate.naming.physical-strategy=com.alibaba.nacos.config.server.configuration.NacosPhysicalNamingStrategy
nacos.datasource.type=ORACLE
nacos.datasource.relational.dsList[0].url=jdbc:oracle:thin:@192.168.0.12:1521:XE
nacos.datasource.relational.dsList[0].username=oracle
nacos.datasource.relational.dsList[0].password=oracle
nacos.datasource.relational.dsList[0].driver-class-name=oracle.jdbc.driver.OracleDriver
</code>Start Nacos.
<code>./startup.sh -m standalone</code>Summary
The official
feature_multiple_datasource_supportbranch is no longer maintained, meaning the multi‑datasource compatible Nacos version is 1.4.2.
Nacos 1.4.2 corresponds to Spring Cloud Alibaba 2021.1 and generally meets daily needs.
The
feature_multiple_datasource_supportbranch is based on Spring Data JPA.
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.