断点

每天进步一点点!
posts - 174, comments - 56, trackbacks - 0, articles - 21

异常如下:

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)

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)
    )
  )


posted @ 2009-03-04 17:33 断点 阅读(3508) | 评论 (0)

只有注册用户登录后才能发表评论。


网站导航: