应国产化需求需要,需将系统中涉及的各中间件替换成国产中间件,此文介绍了MySQL替换成OceanBase的步骤,该文已验证测试过
离线单机部署 OceanBase 数据库
(官方地址: https://www.oceanbase.com/docs/community-obd-cn-1000000001477793)
1.下载all-in-one安装包
2.安装单机版OceanBase
tar -xzf oceanbase-all-in-one-*.tar.gz
cd oceanbase-all-in-one/bin/
./install.sh
source ~/.oceanbase-all-in-one/bin/env.sh
如果安装过程中报以下错误

解决方案:
根据提示修改配置并重启服务器(不重启可能不生效)

安装成功记录配置
3. 修改项目代码
spring:
datasource:
driverClassName: com.oceanbase.jdbc.Driver
druid:
master:
url: jdbc:
oceanbase://139.196.16.97:2881/ry2?useServerPrepStmts=true&rewriteBatchedStatements=true
4.修改pom配置,mysql驱动包改成oceanbase驱动包
<!-- Mysql驱动包 -->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- </dependency>-->
<!--oceabase驱动包-->
<dependency>
<groupId>com.oceanbase</groupId>
<artifactId>oceanbase-client</artifactId>
<version>2.4.2</version>
</dependency>