使用 DBeaver 连接 OB Oracle 数据库

本文介绍了如何使用 DBeaver 连接 OB Oracle 数据库,包括下载 DBeaver,新建 OB Oracle 驱动,配置连接参数,并成功执行 SQL 查询。详细步骤包括软件下载、驱动配置、数据库连接测试等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言

  • OB MySQL 兼容 MySQL 协议和驱动,因此可以直接使用 MySQL 生态的数据库开发工具,比如 MySQL ClientNavicatSequel Pro 等,唯一需要注意的是 OB MySQL 的用户名格式为 {用户名}@{租户名},详见。

![image.png](https://img-blog.csdnimg.cn/img_convert/815de820868c9a6c56d46e6a428e3ec2.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=458&id=u20e3485d&margin=[object Object]&name=image.png&originHeight=916&originWidth=1140&originalType=binary&ratio=1&rotation=0&showTitle=false&size=303741&status=done&style=none&taskId=u4451e660-52a4-4f1b-8c8d-2642e463373&title=&width=570)

  • Oracle 是商业闭源数据库,其数据库协议并未对外公开,因此 OB Oracle 仅在数据库行为和 SQL 语法等方面与 Oracle 保持兼容,无法使用基于 Oracle 驱动的 SQL DeveloperNavicat 工具进行连接。

![image.png](https://img-blog.csdnimg.cn/img_convert/3d6082aae18c7a3a9664c05d1d59559a.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=403&id=u725a9800&margin=[object Object]&name=image.png&originHeight=806&originWidth=916&originalType=binary&ratio=1&rotation=0&showTitle=false&size=188237&status=done&style=none&taskId=u4834f232-feec-4add-9d45-d4e2065a400&title=&width=458)

  • 目前官方推荐使用 OBClientODC 工具来连接 OB Oracle,实际上基于 DBeaver 强大的自定义数据库驱动能力,也能实现 DBeaver 连接 OB Oracle 数据库。

配置流程

软件下载

![image.png](https://img-blog.csdnimg.cn/img_convert/20b72efd006cfb89f0aa7a00cd0b3470.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=379&id=G4Eow&margin=[object Object]&name=image.png&originHeight=1424&originWidth=1838&originalType=binary&ratio=1&rotation=0&showTitle=false&size=832528&status=done&style=none&taskId=ub02790f1-7bfe-4c2f-8001-61d5f733354&title=&width=489)

  • 安装完后打开 数据库->驱动管理器,可以看到已经有了一个 OceanBase 驱动,说明 DBeaver 官方集成并支持 OB 数据库连接,只不过这个驱动只支持 OB MySQL。因此我们需要手动新建 OB Oracle 的驱动。

![image.png](https://img-blog.csdnimg.cn/img_convert/384f9e3061c7c26c17fb71b3d4104e6d.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=365&id=u3e00bb27&margin=[object Object]&name=image.png&originHeight=662&originWidth=470&originalType=binary&ratio=1&rotation=0&showTitle=false&size=170995&status=done&style=none&taskId=ue7369a96-dd2f-420f-84e6-2f499e2d2d8&title=&width=259)![image.png](https://img-blog.csdnimg.cn/img_convert/5b80042c648bdf254c388c7d4042f190.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=366&id=ua084d2d3&margin=[object Object]&name=image.png&originHeight=874&originWidth=870&originalType=binary&ratio=1&rotation=0&showTitle=false&size=252975&status=done&style=none&taskId=ua1d56148-4fba-4a4b-bfab-bfd0080a383&title=&width=364)

新建 OB Oracle 驱动

  • 功能入口: 数据库->驱动管理器->新建
  • 先设置库信息: 添加文件 -> 选中下载的驱动文件 -> 找到类 -> 加载驱动类。

![image.png](https://img-blog.csdnimg.cn/img_convert/89e7f679956f2f845a1ed0582a62266a.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=444&id=u579ef7a4&margin=[object Object]&name=image.png&originHeight=888&originWidth=1000&originalType=binary&ratio=1&rotation=0&showTitle=false&size=296781&status=done&style=none&taskId=u811a4a60-a5c3-4bd6-bd12-5465c9ac2a1&title=&width=500)

  • 再设置驱动的基本信息和连接信息,其中类名为 com.alipay.oceanbase.jdbc.Driver,URL 模板为 jdbc:oceanbase://<server>:<port>/<database>
    :::info
    📢 需要注意: 驱动类型需要选 Generic,不能选 OceanBase (那是给 OB MySQL 模式用的)。
    :::
    ![image.png](https://img-blog.csdnimg.cn/img_convert/73d6d50f1a4b0bf462daa40b8a2145f6.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=443&id=u4baa284c&margin=[object Object]&name=image.png&originHeight=886&originWidth=1000&originalType=binary&ratio=1&rotation=0&showTitle=false&size=245661&status=done&style=none&taskId=u0d56d52b-a3dc-45d8-843e-f1c7ad450c5&title=&width=500)

新建数据库连接

  • 功能入口: 数据库->新建数据库连接

![image.png](https://img-blog.csdnimg.cn/img_convert/9fffd0dd3a1e6f1c12ff12630f0ac0cd.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=335&id=ufa9b5fc1&margin=[object Object]&name=image.png&originHeight=670&originWidth=476&originalType=binary&ratio=1&rotation=0&showTitle=false&size=171029&status=done&style=none&taskId=uf6c9a0db-637b-4ac9-809a-e2451b5669d&title=&width=238)

  • 选择刚刚新建的 OceanBase Oracle驱动。

![image.png](https://img-blog.csdnimg.cn/img_convert/9a4bbc3a70a3a5dd72f2fd630b157644.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=628&id=Vlz3E&margin=[object Object]&name=image.png&originHeight=1256&originWidth=1386&originalType=binary&ratio=1&rotation=0&showTitle=false&size=327058&status=done&style=none&taskId=uf904f7b8-947d-40dc-a660-ee5758380c1&title=&width=693)

  • 设置 JDBC 连接信息,这里只要设置用户名和密码。

![image.png](https://img-blog.csdnimg.cn/img_convert/9c5333af5f9187f486c8ab4bcdca82a6.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=628&id=u297a8a4a&margin=[object Object]&name=image.png&originHeight=1256&originWidth=1390&originalType=binary&ratio=1&rotation=0&showTitle=false&size=345542&status=done&style=none&taskId=uba9cdc39-3c9a-4f4a-8c13-78a1b904bec&title=&width=695)

  • 实际的连接参数需要在 驱动属性中设置,包括 DANAME、HOST 和 PORT。由于 Oracle 没有数据库的概念,因此这里的 DANAME 填写 SYS 即可。

![image.png](https://img-blog.csdnimg.cn/img_convert/60bac122463ecf29827affec39b08ff6.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=638&id=u35c86ec4&margin=[object Object]&name=image.png&originHeight=1276&originWidth=1386&originalType=binary&ratio=1&rotation=0&showTitle=false&size=383139&status=done&style=none&taskId=u93f51a11-ab94-4757-be1b-18c4163f9fa&title=&width=693)

  • 连接测试成功:

![image.png](https://img-blog.csdnimg.cn/img_convert/79052120ac7214c1ea401871823340be.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=228&id=uf6592f9b&margin=[object Object]&name=image.png&originHeight=456&originWidth=872&originalType=binary&ratio=1&rotation=0&showTitle=false&size=124518&status=done&style=none&taskId=u0b285965-1224-4518-9e33-d7c6e5af212&title=&width=436)

  • 连接新建成功:

![image.png](https://img-blog.csdnimg.cn/img_convert/ea96c4d5c4d4f31f364e63172c25472f.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=257&id=ud5b6690e&margin=[object Object]&name=image.png&originHeight=514&originWidth=678&originalType=binary&ratio=1&rotation=0&showTitle=false&size=135296&status=done&style=stroke&taskId=uebd5d381-e126-4873-a4c6-f56afd15787&title=&width=339)

成功执行 SQL 👏🏻

![image.png](https://img-blog.csdnimg.cn/img_convert/510277a8ba64d9eb163c7a672fd0847b.png#clientId=u7a910238-8f91-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=720&id=u25c66a2d&margin=[object Object]&name=image.png&originHeight=1440&originWidth=2304&originalType=binary&ratio=1&rotation=0&showTitle=false&size=873300&status=done&style=none&taskId=u33dedddb-c053-464c-b446-2d1be26a26a&title=&width=1152)

参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值