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

相关推荐
霸道流氓气质12 小时前
领域驱动设计(DDD)在 Spring Boot 微服务中的实践指南
运维·spring boot·微服务
于先生吖13 小时前
SpringBoot对接大模型开发AI命理测算系统:八字排盘与AI解析接口源码全解
人工智能·spring boot·后端
Flittly13 小时前
【AgentScope Java新手村系列】(10)实战-多Agent天气助手
java·spring boot·spring
曹牧15 小时前
Oracle EXPLAIN PLAN
数据库·oracle
贤时间15 小时前
codex 助力oracle ebs 开发
数据库·oracle
秉承初心15 小时前
PostgreSQL 数据性能瓶颈突破实战
数据库·postgresql·oracle
星落zx16 小时前
Spring Boot 多模型集成:优雅调用全球主流大模型
人工智能·spring boot·chatgpt
一杯奶茶¥16 小时前
水果销售网站 CRM客户信息管理系统 超市管理系 酒店管理系统 健身房管理系统 在线音乐网站 校园招聘系统
java·vue.js·spring boot·mysql·spring·java项目
进阶的小名17 小时前
Spring Boot SSE + Nginx 配置:解决 EventSource 不实时返回、连接超时、流式响应被缓冲问题
spring boot·后端·nginx
我登哥MVP18 小时前
SpringCloud Alibaba 核心组件解析:服务链路追踪
java·spring boot·后端·spring·spring cloud·java-ee·maven