数据库连接错误The Network Adapter could not establish the connection
2014-03-29 18:12
561 查看
连接数据库报错
java.sql.SQLException: The Network Adapter could not establish the connection
用sqlplus 连接数据库可以连上
java连接时报错。
解决办法:
把admin目录下的listener.ora和tnsnames.ora文件中的HOST全部改为:HOST = 127.0.0.1
import
java.sql.*;
public class JDBCTest {
public static void main(String[] args) throws Exception{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@127.0.0.1:1521:orcl", "scott", "×××");
}
}
java.sql.SQLException: The Network Adapter could not establish the connection
用sqlplus 连接数据库可以连上
java连接时报错。
解决办法:
把admin目录下的listener.ora和tnsnames.ora文件中的HOST全部改为:HOST = 127.0.0.1
import
java.sql.*;
public class JDBCTest {
public static void main(String[] args) throws Exception{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@127.0.0.1:1521:orcl", "scott", "×××");
}
}
相关文章推荐
- 连接数据库错误The Network Adapter could not establish the connection
- 数据库连接错误The Network Adapter could not establish the connection之琴宝所见
- [置顶] 数据库连接错误The Network Adapter could not establish the connection
- 数据库连接错误The Network Adapter could not establish the connection
- jdbc连接错误 SQLException: The Network Adapter could not establish the connection
- 数据库连接报错之IO异常(The Network Adapter could not establish the connection)
- 数据库连接异常The Network Adapter could not establish the connection
- oracle 11g JDBC连接数据库:IO异常The Network Adapter could not establish the connection 解决方法
- 使用Oracle SQL Developer连接数据库时,提示“执行请求的操作时遇到错误:IO 错误: The Network Adapter could not establish”,不知如何处理
- 解决Linux下JSP连接Orcale的著名错误Java.SQL.Exception The Network Adapter could not establish the connection .
- 数据库连接报错之IO异常(The Network Adapter could not establish the connection)
- 在Myeclipse里创建oracle连接时,出现:The Network Adapter could not establish the connection 错误
- web程序本地通过ip地址链接不到数据库oracle11g,异常错误 The Network Adapter could not establish the connection
- Java连接Oracle异常The Network Adapter could not establish the connection
- IO 错误: The Network Adapter could not establish the connection
- Myeclipse链接Oracle等数据库时lo exception: The Network Adapter could not establish the connection
- ORACLE数据库连接之Io异常The Network Adapter could not establish the connection
- 注册表 MaxUserPort的值 和 “The Network Adapter could not establish the connection” “Address already in use” 错误
- 连接Oracle数据库,出现The Network Adapter could not establish the connection
- 注册表 MaxUserPort的值 和 “The Network Adapter could not establish the connection” “Address already in use” 错误