springboot连接oracle报错ORA-12505解决方案

springboot连接oracle报错ORA-12505解决方案

springboot项目,在测试环境连接正常,生产环境连接数据库报错ORA-12505。

测试环境连接数据库语句为jdbc:oracle:thin:@xxxx.xxxx.xxxx.xxxx:1521:orcl

生产环境修改对应ip后报错ORA-12505, TNS:listener does not currently know of SID。

百度查询jdbc连接数据库的时候,需要使用数据库的sid_name,

参考文章:https://blog.csdn.net/qq_38050852/article/details/83151095

但是由于生产环境只开放了部分视图权限,执行查询sid语句select INSTANCE_NAME from v$instance;报错找不到表或视图,只好另寻解决方案。

经过尝试,最后将 :orcl 部分改为 /orcl 解决,即 jdbc:oracle:thin:@xxxx.xxxx.xxxx.xxxx:1521/orcl

问题原因: jdbc:oracle:thin:@xxxx.xxxx.xxxx.xxxx:1521:orcl,该连接方式:后面需跟上sid_name;

jdbc:oracle:thin:@xxxx.xxxx.xxxx.xxxx:1521/orcl而这种连接方式 / 后面需填入server_name;

在无法查询sid的情况下可以使用第二种连接方式

参考:https://blog.csdn.net/a932946893/article/details/113374715

相关推荐
Rain的Java大神之路2 小时前
Spring Boot 4 把自动配置拆成 47 个模块后,我的 `dependency:tree` 翻天了:一份从排查到治理的完整实战手册
java·spring boot·后端
软件技术NINI5 小时前
基于 SpringBoot 的酒店预定系统
java·spring boot·后端
软件技术NINI5 小时前
基于 Spring Boot 中国历史知识学习系统
spring boot·后端·学习
她的男孩7 小时前
会签选了候选角色,发起却报 nrOfInstances:Forge Admin 改成按人展开集合
spring boot·低代码·工作流引擎
学长毕设8 小时前
基于SpringBoot 宠物商城领养网站-附源码
spring boot·后端·宠物
AI开源软件9 小时前
SpringCloud+Nacos 业务协同落地:业务调用与集成中心远程管理如何分别配置
java·spring boot
BruceVan10 小时前
给 AI 配上 Context7:查文档更准,还更省 token
vue.js·spring boot·ai编程
FYKJ_201019 小时前
springboot众创项目团队管理系统94666-计算机课程设计、毕业设计
java·vue.js·spring boot·后端·python·spark·课程设计
CoderYanger20 小时前
Java EE 进阶:14.案例综合练习-博客系统(第二弹):博客详情+令牌技术
服务器·前端·spring boot·后端·spring·java-ee·github
FYKJ_20101 天前
springboot贫困生认定管理系统59009-计算机毕业设计、课程设计
java·javascript·vue.js·spring boot·后端·django·课程设计