求助啊 用户名密码没错 sid没错 pl/sql正常连接 但是java jdbc连接就连接错误
网上试了些方法 无解、、谁能帮助下
还有 jdbc 驱动也换了 几个 都不行
下面是 myeclipse 控制台报错 (数据库是oracle 11G 系统windows7)
java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=186646784)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:345)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:428)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:515)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:345)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.accp.per.oracle.test.MasterManager.login(MasterManager.java:25)
at com.accp.per.oracle.test.MasterManager.login(MasterManager.java:70)
at com.accp.per.oracle.test.MasterManagerTest.main(MasterManagerTest.java:6)
大哥们帮帮忙吧、我都纠结死了!
------解决方案--------------------
看下product\11.1.0\db_1\NETWORK\ADMIN中的tnsnames.ora中配置
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
SERVICE_NAME 估计你写错了
------解决方案--------------------
看报的错误 是监听器没有监听到localhost的1521...
检查你的oracle监听配置:
listener.ora文件,看看监听配置是否正确
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = WIN-BS0A72TT11V)(PORT = 1521))
)
)
host最好配置为本机机器名。。。防止你的系统的hosts里面对localhost或127.0.0.1做了映射。。。
监听器检查如果没有异常:那么就ping一下localhost看看指向的ip,然后查看对应ip地址的机器有没有开启1521端口。。。
一步步排查。。。