帮忙给看一个java访问oracle的错误
SQLState: null
Message: Io 异常: The Network Adapter could not establish the connection
ErrorCode: 17002
booking version 1.01 2003-08-07
SQLState: null
Message: Io 异常: The Network Adapter could not establish the connection
ErrorCode: 17002
booking version 1.01 2003-08-07
SQLState: null
Message: Io 异常: The Network Adapter could not establish the connection
ErrorCode: 17002
booking version 1.01 2003-08-07
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at cn.diny.ads.sysconf.CategoryPanel.dataInit(CategoryPanel.java:204)
at cn.diny.ads.sysconf.CategoryFieldPane.<init>(CategoryFieldPane.java:60)
at cn.diny.ads.sysconf.CategoryField.jbInit(CategoryField.java:25)
at cn.diny.ads.sysconf.CategoryField.init(CategoryField.java:18)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at cn.diny.ads.sysconf.FieldPanel.initCategory(FieldPanel.java:361)
at cn.diny.ads.sysconf.FieldPanel.dataInit(FieldPanel.java:379)
at cn.diny.ads.sysconf.CategoryFieldPane.stateChanged(CategoryFieldPane.java:67)
at javax.swing.JTabbedPane.fireStateChanged(Unknown Source)
at javax.swing.JTabbedPane$ModelListener.stateChanged(Unknown Source)
at javax.swing.DefaultSingleSelectionModel.fireStateChanged(Unknown Source)
at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(Unknown Source)
at javax.swing.JTabbedPane.setSelectedIndexImpl(Unknown Source)
at javax.swing.JTabbedPane.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI$MouseHandler.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
劳烦给解释一下为什么,能不能修改,其他页面都正常,就是这个页面,是不是因为oracle的启动参数不合理
[解决办法]
数据库实例没有运行。请启动数据库实例服务再次尝试
[解决办法]
Io 异常: The Network Adapter could not establish the connection
这个异常的出现一般与数据库 设置 和你的计算机的设置 有关,一般程序逻辑是没有问题的。
这种异常的出现大致上有下面4种:
1、oracle配置
oracle9i2中把C:\oracle\ora92\network\admin 目录下的listener.ora 和tnsnames.ora 文件中的HOST改为:HOST = 127.0.0.1 。如下(玫红色标记为需要修改处):
(注意:连接远程计算机中oracle数据库的配置中的host不可修改。)
File: C:\oracle\ora92\network\admin\listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1 )(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\ora92)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = tfpc)
(ORACLE_HOME = C:\oracle\ora92)
(SID_NAME = tfpc)
)
)
**********************
File: C:\oracle\ora92\network\admin\tnsnames.ora
TFPC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1 )(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = tfpc)
)
)
INST1_HTTP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1 )(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = MODOSE)
(PRESENTATION = http://HRService)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
2、IP错误
在设置URL时错误,例如:jdbc:oracle:thin:@192.168.0.36:1521:sharp
数据库服务器不正确:ping 服务器IP是否正确。不正确,将URL更改为正确
端口号错误:一般不会错误。
进行一下操作:在DOS上键入sqlplus,检查oracle是否开启
一却正常,执行下面第3步。
3、防火墙
如果机器上安装有放火墙,可能是服务器端口号屏蔽而造成的。关闭防火墙后,尝试重新连接。
仍然不行,执行第4步。
4、数据库监听未启动
[解决办法]
楼上高手在解
[解决办法]
配置问题没的问题吗?连接问题肯定是配置没陪好