Io 异常: The Network Adapter could not establish the connection
异常如下:
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
主要原因:
1.可能是server.xml文件的DataSource配置出错。
(1).如果用到的是本机上的数据,本地数据源里的部分配置为: username="pcisv62" password="11" url="jdbc:oracle:thin:@localhost:1521:orcl"
(2).如果用到的是服务器上的数据,则数据源里的部分配置为: username="pcisv62" password="11" url="jdbc:oracle:thin:@dbserver:1521:corev6"
(dbserver为服务器的名字,corev6为服务器上Oracle的SID)
(3).是否导入架包class12.jar
2.可能是oracle的tnsnames.ora文件配置出错。
oracle的安装目录E:\oracle\ora92\network\admin下的tnsnames.ora:
本地配置:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 主机名)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
或服务器配置:
COREV6_DBSERVER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
)
(CONNECT_DATA =
(SID = COREV6)
(SERVER = DEDICATED)
)
)
分享到:
相关推荐
The Network Adapter could not establish the connection
当遇到“连接不到数据库”的问题时,通常会显示如"Io异常: The Network Adapter could not establish the connection"这样的错误信息。这个异常表明应用程序无法与数据库建立网络连接,可能由多种原因造成。以下是...
Oracle10G控制台解决办法-Io 异常:Unknown host specified解决方法
6. 连接 Oracle 时抛出如下异常:java.sql.SQLException: Io exception: The Network Adapter could not establish connection 解决方法: * 检查 Oracle 实例是否正常运行。 * 检查连接数据库的用户名和密码是否...
在Android应用开发中,用户界面(UI)的状态管理是一项至关重要的任务。这涉及到如何优雅地展示数据加载、数据为空、网络请求失败等不同场景。在本文中,我们将深入探讨如何实现"View各种状态的切换",包括数据加载...
Could not resolve dependencies for project org.apache.flink:flink-avro-confluent-registry:jar:1.15.3: Could not find artifact io.confluent:kafka-schema-registry-client:jar:6.2.2 in maven 安装本地...
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ReportViewer.WinForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies....
Failure to transfer org.... Original error: Could not transfer artifact org.codehaus.plexus:plexus-io:jar: 1.0.1 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000
在windows环境下的eclipse或者idea中编写spark应用时,有时为了验证程序功能需要以本地模式运行...java.io.Exception: Could not locate executable null\bin\winutils.exe in the Hadoop binarie 本文件可以解决此异常
报错:java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.-附件资源
docker load -i prometheus-adapter-v0.9.1.tar.gz ; docker images |grep k8s.gcr.io/prometheus-adapter/prometheus-adapter
"java.net.SocketException Connection reset 解决方法" 在 Java 编程中,SocketException 是一种常见的异常,特别是在网络编程中。Conexion reset by peer 是一种特殊的 SocketException,它发生在客户端和服务器...
在编程过程中,尤其是在使用C#进行文件系统操作时,可能会遇到这样一个问题:当你尝试删除一个目录,系统返回“System.IO.IOException: 目录不是空的”错误。这意味着该目录下仍有文件或子目录存在,因此无法直接...
当你尝试`Test Driver`时,可能会遇到“Error while performing database login with the oracle.jdbc.driver.OracleDriver driver: Io exception: The Network Adapter could not establish the connection”的错误...
Java.io.CharConversionException: isHexDigit 是 Java 中一种常见的异常,通常发生在传输数据时编码不正确或 URL 传值时出现问题。本文将对该异常进行详细分析,介绍导致该异常的原因和解决方法。 一、问题描述 ...
Android Studio上运行Flutter,报错could not find io.flutter:flutter_embedding_debug的错误,需要替换以上zip文件即可,Android Studio 4.2.0, Flutter 2.2.3, Dart 2.13.4
6. **IO异常处理**:提供了一些更易用的异常类,使得处理IO异常时的代码更简洁。 7. **缓冲区操作**:提供了`BufferedInputStream`和`BufferedOutputStream`的增强版本,提高了读写性能。 8. **路径处理**:提供了...