Nacos-2.2.2源码修改集成高斯数据库GaussDB,postresql

一 ,下载代码

Release 2.2.2 (Apr 11, 2023) · alibaba/nacos · GitHub

二, 执行打包

mvn -Prelease-nacos -Dmaven.test.skip=true -Drat.skip=true clean install -U

mvn -Prelease-nacos '-Dmaven.test.skip=true' '-Drat.skip=true' clean install -U

注意:请不要把源码放在中文路径下,会报各种意想不到的错误。

打包的结果在distribution中

三,添加驱动jar包

1,根目录下:/pom.xml

postgresql

复制代码
<postgresql.version>42.3.3</postgresql.version>

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>${postgresql.version}</version>
</dependency>

高斯的

复制代码
<opengauss.version>3.0.0</opengauss.version>

<dependency>
    <groupId>org.opengauss</groupId>
    <artifactId>opengauss-jdbc</artifactId>
    <version>${opengauss.version}</version>
</dependency>

2,config项目下的 /pom.xml

postgresql的

复制代码
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
</dependency>

高斯的

复制代码
<dependency>
   <groupId>org.opengauss</groupId>
   <artifactId>opengauss-jdbc</artifactId>
</dependency>

3,naming项目下的

postgresql的

复制代码
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
</dependency>

高斯的

复制代码
 <dependency>
      <groupId>org.opengauss</groupId>
      <artifactId>opengauss-jdbc</artifactId>
 </dependency>

四,添加PostgreSQL驱动代码

高斯的驱动代码和PostgreSQL是一模一样的

① PropertiesConstant.java

复制代码
    public static final String POSTGRESQL = "postgresql";

② PropertyUtil.java#loadSetting

复制代码
String platform = DatasourcePlatformUtil.getDatasourcePlatform("");
            /*boolean useExternalStorage = !PropertiesConstant.EMPTY_DATASOURCE_PLATFORM.equalsIgnoreCase(platform)
                    && !PropertiesConstant.DERBY.equalsIgnoreCase(platform);
             setUseExternalDB(useExternalStorage);*/
            setUseExternalDB(PropertiesConstant.MYSQL.equalsIgnoreCase(platform) || PropertiesConstant.POSTGRESQL.equalsIgnoreCase(platform));

③ ExternalDataSourceProperties.java

复制代码
    private static final String JDBC_DRIVER_NAME_POSTGRESQL = "org.postgresql.Driver";

④ StartingApplicationListener.java

复制代码
    private static final String DATABASE_POSTGRESQL = "postgresql";

五, 配置文件

数据库链接自己配置

相关推荐
我在北京coding5 小时前
300道GaussDB(WMS)题目及答案。
数据库·gaussdb
ItisNagatoYuki7 小时前
Mac M芯片 RAG 极简流程 安装 ragflow + LM studio
macos
云攀登者-望正茂10 小时前
如何在mac上安装podman
macos·podman
江梦寻16 小时前
MacOS下Homebrew国内镜像加速指南(2025最新国内镜像加速)
开发语言·后端·python·macos·架构·策略模式
*Lisen16 小时前
重新安装解决mac vscode点击不能跳转问题
ide·vscode·macos
weixin_387545641 天前
如何把 Mac Finder 用得更顺手?——高效文件管理定制指南
macos
itme2681 天前
解决cocos 2dx/creator2.4在ios18下openURL无法调用的问题
macos·objective-c·cocoa
qq_279456151 天前
CADisplayLink、NSTimer、GCD定时器
macos·objective-c·cocoa
RR13352 天前
macOS 升级 bash 到最新版本
macos
我在北京coding2 天前
Tableau for mac 驱动
macos