关于ORA-12505, TNS:listener does not currently know of SID given in connect descriptor报错问题解决办法
1、本机tnsnames.ora 配置如下
test4=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.4)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
2、代码配置如下:
spring.datasource.url = jdbc:oracle:thin:@192.168.1.4:1521:test4
spring.datasource.username = username
spring.datasource.password = password
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
3、看似好像配置没有问题,但是运行起来一直报ORA-12505错误。
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
4、反复测试Oracle服务端监听正常。
5、最后发现配置问题,改正为如下配置:
①spring.datasource.url = jdbc:oracle:thin:@//192.168.1.4:1521/orcl
②spring.datasource.url = jdbc:oracle:thin:@192.168.1.4:1521:orcl
以上两种方法均可以。
6、总结:Oracle有两种配置方式,SID指的是全局数据库名,而并非你本地的tnsnames.ora中配置的别名。
所以,在配置的时候,应该首先知道数据库配置的全局数据库名,再去代码中配置。
格式一:jdbc:oracle:thin:@//<host>:<port>/<service_name>
格式二:jdbc:oracle:thin:@<host>:<port>:<SID>
格式三:jdbc:oracle:thin:@<TNSName>

关于ORA-12505, TNS:listener does not currently know of SID given in connect descriptor报错问题解决办法的更多相关文章
- Connection to Oracle failed. [66000][12505] Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor .
我安装了Oracle数据库,默认的数据库用户名是system,密码口令是安装过程中你自己设置的.可以先使用命令框,输入 sqlplus system; 然后再输入密码即可. 然后我的数据库连接工具使用 ...
- Oracle - ORA-12505, TNS:listener does not currently know of SID given in connect descriptor 解决
java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:list ...
- ORA-12505, TNS:listener does not currently know of SID given in connect descriptor (二)
异常及解决 在连接sqldeveloper出现的异常信息 在ORA-12505, TNS:listener does not currently know of SID given in connec ...
- ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
引子: 本项目在老电脑上用的是oracle10g,换新电脑装的是oracle11g,但运行项目本没有什么关系,本来说创建个用户,用PLSQL手工导入数据,再改几下配置文件即可跑起来--但实际启动中遇到 ...
- 连接oracle数据库出现:ORA-12505,TNS:listener does not currently know of SID given in connect descriptor
Java使用 jdbc:oracle:thin:@11.1.0.14:1521:orcl 连接oracle数据库出现: ORA-12505,TNS:listener does not currentl ...
- 66000][12505] Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor oracle.n et.ns.NetException: Listener refuse
新装的idea开发工具后连接数据库出现如题所示错误. 1.网上搜了不少的文章,没有解决我的问题.后来细心看了一下url: 一开始url是这样子的. jdbc:oracle:thin:@:s21_pdb ...
- 【java】ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
如果是负载均衡,则 jdbc.url=jdbc:oracle:thin:@(description=(address_list= (address=(host=XX.XXX.X.XX) (protoc ...
- ORA-12514, TNS:listener does not currently know of service requested in connect descriptor案例2
今天使用SQL Developer连接一台测试服务器数据库(ORACLE 11g)时,遇到了"ORA-12514, TNS:listener does not currently know ...
- oracle ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor 1.看看是不是监听 ...
随机推荐
- 【转】AngularJs HTTP请求响应拦截器
任何时候,如果我们想要为请求添加全局功能,例如身份认证.错误处理等,在请求发送给服务器之前或服务器返回时对其进行拦截,是比较好的实现手段. angularJs通过拦截器提供了一个从全局层面进行处理的途 ...
- [初识]使用百度AI接口,图灵机器人实现简单语音对话
一.准备 1.百度ai开放平台提供了优质的接口资源https://ai.baidu.com/ (基本免费) 2.在语音识别的接口中, 对中文来说, 讯飞的接口是很好的选择https://www.xf ...
- 实现域名访问网站—nginx反向代理
今天在跟项目的时候,是否被耍了三个多小时,最后在我准备号材料准备他人求助的时候,在收集材料的时候,居然访问通了, 别问我为什么,我也不知道 ,哈哈哈哈(苦逼脸...) 分享出来,大家共同学习: 这个是 ...
- tcp server
SO_REUSEADDR Ignore SIGPIPE TCP_NODELAY TCP_QUICKACK
- gulp 打包错误 TypeError: Path must be string. Received undefined
Running gulp gives “path.js:7 throw new TypeError('Path must be a string. Received ' + inspect(path) ...
- 关于Java抽象类,接口与实现接口及派生类继承基类
1. 抽象类 抽象类就是有一个或多个方法只被声明而未被实现. 抽象方法的声明以分号结束,并且用关键字abstract来说明它以标识它为抽象方法. 格式: public abstract class 类 ...
- tomcat服务的启动与隐藏启动(win)
一: tomcat的启动与隐藏启动 1. 正常启动:D:\apache-tomcat-8.5.24\bin中的 startup.bat 双击启动 2. 启动tomcat服务后,window下方 ...
- maven build的常用生命周期
常用的maven build goals: validate - validate the project is correct and all necessary information is av ...
- flask框架~简易编写
flaks框架: 先导报 from flask import Flask 重定向模块:redirect url_for是简易寻址跳转 jsonify强转为json格式 建立flask对象:app = ...
- xamarin自定义 application 无法调试
我们在默认使用application 的时候发现 调试会爆异常 [application] public class DemoApplication:Application { } 根本原因是构造器 ...