• 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的 

    1. <postgresql.version>42.3.3</postgresql.version>
    2. <dependency>
    3. <groupId>org.postgresql</groupId>
    4. <artifactId>postgresql</artifactId>
    5. <version>${postgresql.version}</version>
    6. </dependency>

    高斯的

    1. <opengauss.version>3.0.0</opengauss.version>
    2. <dependency>
    3. <groupId>org.opengauss</groupId>
    4. <artifactId>opengauss-jdbc</artifactId>
    5. <version>${opengauss.version}</version>
    6. </dependency>

    2,config项目下的 /pom.xml

    postgresql的

    1. <dependency>
    2. <groupId>org.postgresql</groupId>
    3. <artifactId>postgresql</artifactId>
    4. </dependency>

    高斯的

    1. <dependency>
    2. <groupId>org.opengauss</groupId>
    3. <artifactId>opengauss-jdbc</artifactId>
    4. </dependency>

    3,naming项目下的

     postgresql的

    1. <dependency>
    2. <groupId>org.postgresql</groupId>
    3. <artifactId>postgresql</artifactId>
    4. </dependency>

    高斯的

    1. <dependency>
    2. <groupId>org.opengauss</groupId>
    3. <artifactId>opengauss-jdbc</artifactId>
    4. </dependency>

    四,添加PostgreSQL驱动代码

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

    ① PropertiesConstant.java

        public static final String POSTGRESQL = "postgresql";
    

    ② PropertyUtil.java#loadSetting

    1. String platform = DatasourcePlatformUtil.getDatasourcePlatform("");
    2. /*boolean useExternalStorage = !PropertiesConstant.EMPTY_DATASOURCE_PLATFORM.equalsIgnoreCase(platform)
    3. && !PropertiesConstant.DERBY.equalsIgnoreCase(platform);
    4. setUseExternalDB(useExternalStorage);*/
    5. 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";
    

    五, 配置文件

    数据库链接自己配置

  • 相关阅读:
    Vue项目实战之人力资源平台系统(六)角色管理模块
    SpringMVC+Vue项目高校课程评价系统
    字节小程序填坑说明
    springmvc (四种跳转方式)重定向,转发到页面和action的区别
    目标检测系列算法:YOLOv6代码复现
    开源AI聚合工具 支持AI 聊天、协作、图像生成-AIdea
    Qt for Android实现开机自启动
    一周入门Python之day06
    1.数据库的连接、创建会话与模型
    猿创征文 |简单入门linux命令
  • 原文地址:https://blog.csdn.net/m0_37647376/article/details/134227954