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";

五, 配置文件

数据库链接自己配置

相关推荐
0wioiw01 小时前
Onesignal(Xcode)
ide·macos·xcode
哈基米~南北绿豆3 小时前
虚拟机体验:在Windows/Mac上运行鸿蒙PC开发环境
windows·macos·harmonyos
DarkAthena9 小时前
【GaussDB】排查创建索引后查询数据行数发生变化的问题
数据库·sql·gaussdb
2601_9491465313 小时前
APP语音通知接口集成实战:移动端应用接入语音提醒API的开发手册
macos·objective-c·cocoa
DarkAthena14 小时前
【GaussDB】用AI解析UGO中的SQL审核模块的实现
数据库·sql·gaussdb
小鹿软件办公15 小时前
Apple 发布 macOS 11、watchOS 10 和 watchOS 9 更新
macos·objective-c·cocoa
chao_7892 天前
双设备全栈开发最佳实践[mac系统]
git·python·macos·docker·vue·全栈
2501_915921432 天前
不用 Xcode 上架 iOS,拆分流程多工具协作完成 iOS 应用的发布准备与提交流程
android·macos·ios·小程序·uni-app·iphone·xcode
Ron丶2 天前
iOS 旧版本 App 下载方法汇总:如何获取历史版本 IPA(2026 仍有效)
windows·经验分享·macos·ios·电脑
编程小风筝2 天前
MAC物理地址和IP网络地址有什么区别?
网络协议·tcp/ip·macos