2012-07-12 81 views
1

可能重复:
Eclipse cannot connect oracle 10g XE on windows 7无法连接的Oracle 10g XE到Eclipse

我得到这个错误,当我尝试测试连接..

java.sql.SQLException:Io exception:网络适配器无法建立连接“

现在该怎么办?我也从网站下载了ojdbc14.jar,但仍然收到此错误。

+0

向我们展示您尝试连接的代码 – Razvan 2012-07-12 12:46:31

+0

您的连接属性可能不好或无法访问数据库(防火墙存在?) – esmoreno 2012-07-12 12:48:38

+0

您正在连接哪个Oracle服务器? 'ojdbc14.jar'?和你如何连接? – 2012-07-12 12:49:14

回答

0

相关操作步骤如下检查先用SQL Plus中:

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 29 08:51:27 2008 
Copyright (c) 1982, 2005, Oracle. All rights reserved. 
SQL> conn system 
Enter password: 
Connected. 
SQL> select instance_name from V$instance; 
INSTANCE_NAME 
---------------- 
xe 
SQL> 

Here is the listener status and services 


C:\>lsnrctl services 

LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 29-JUL-2008 08:46:43 
Copyright (c) 1991, 2005, Oracle. All rights reserved. 
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) 
Services Summary... 
Service "XEXDB" has 1 instance(s). 
Instance "xe", status READY, has 1 handler(s) for this service... 
Handler(s): 
"D000" established:0 refused:0 current:0 max:1002 state:ready 
DISPATCHER <machine: KIRANKUMAR-PC, pid: 3632> 
(ADDRESS=(PROTOCOL=tcp)(HOST=KiranKumar-PC)(PORT=49160)) 
Service "XE_XPT" has 1 instance(s). 
Instance "xe", status READY, has 1 handler(s) for this service... 
Handler(s): 
"DEDICATED" established:0 refused:0 state:ready 
LOCAL SERVER 
Service "xe" has 1 instance(s). 
Instance "xe", status READY, has 1 handler(s) for this service... 
Handler(s): 
"DEDICATED" established:0 refused:0 state:ready 
LOCAL SERVER 
The command completed successfully 


C:\>lsnrctl status 

LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 29-JUL-2008 08:46:56 
Copyright (c) 1991, 2005, Oracle. All rights reserved. 
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) 
STATUS of the LISTENER 
------------------------ 
Alias LISTENER 
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production 
Start Date 29-JUL-2008 08:39:27 
Uptime 0 days 0 hr. 7 min. 29 sec 
Trace Level off 
Security ON: Local OS Authentication 
SNMP OFF 
Default Service XE 
Listener Parameter File C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\listener.ora 
Listener Log File C:\oraclexe\app\oracle\product\10.2.0\server\network\log\listener.log 
Listening Endpoints Summary... 
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=KiranKumar-PC)(PORT=1521))) 
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=KiranKumar-PC)(PORT=8080))(Presentation=HTTP)(Session=RAW)) 
Services Summary... 
Service "XEXDB" has 1 instance(s). 
Instance "xe", status READY, has 1 handler(s) for this service... 
Service "XE_XPT" has 1 instance(s). 
Instance "xe", status READY, has 1 handler(s) for this service... 
Service "xe" has 1 instance(s). 
Instance "xe", status READY, has 1 handler(s) for this service... 
The command completed successfully 

C:\>TNSPING xe 
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 29-JUL-2008 08:49:28 
Copyright (c) 1997, 2005, Oracle. All rights reserved. 
Used parameter files: 
C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora 

Used TNSNAMES adapter to resolve the alias 
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = KiranKumar-PC)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE))) 
OK (250 msec) 


C:\>tnsping localhost-pc<hostname> 
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 29-JUL-2008 08:49:42 
Copyright (c) 1997, 2005, Oracle. All rights reserved. 
Used parameter files: 
C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora 
Used HOSTNAME adapter to resolve the alias 
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))) 
OK (170 msec) 

请检查这...让我知道解决的办法..希望这会有所帮助!

+0

对不起,我是新的寿这....但我认为所有上面的代码工作结束“命令完成成功”...但仍然不能从日食到数据库.. – 2012-07-12 13:13:50