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

相关推荐
howard20053 小时前
Spring Boot 版新生报到可视化系统
spring boot·新生报到可视化系统
她的男孩5 小时前
子表只读列界面能改,保存却报不允许编辑:Forge Admin 把字段权限落到子表列
spring boot·低代码·工作流引擎
杨凯凡5 小时前
MySQL 死锁怎么排查?InnoDB 锁等待与 Spring Boot 整事务重试实战
数据库·spring boot·mysql
RuoyiOffice17 小时前
SpringBoot+Vue3 凭证生命周期设计:审核、过账、冲销与反过账怎样保持账目一致
java·spring boot·事务·springboot3·财务系统·会计凭证·ruoyi office
RuoyiOffice18 小时前
KubeSphere 容器云实践:从管理 K8s 到建设企业 PaaS,还需要哪些能力
spring boot·kubernetes·kubesphere·jenkins·paas·微服务部署·ruoyi office
爱吃奥利奥_wen1 天前
SQL Server 基础语法详解:从建库建表到约束与增删改查
服务器·数据库·oracle
软件技术NINI1 天前
基于SpringBoot和Vue的新能源汽车销售推荐系统
java·vue.js·spring boot·后端·汽车·毕业设计·毕设
x_SpiderMan1 天前
搭建Oracle RAC 集群
数据库·oracle
测试界的小码农1 天前
【图数据库实战进阶(03):Neo4j 图数据建模实战——节点、关系与属性应该怎么设计?】
数据库·oracle·neo4j
Flynn Liang1 天前
LangChain4j 生产级工程骨架:12 个模块 + Docker 一键启动
java·spring boot·langchain·rag·langchain4j