jdbc:thin连不上数据库

[复制链接]
查看11 | 回复5 | 2015-11-11 09:58:34 | 显示全部楼层 |阅读模式
所有的win2k的机器上这段代码都能连上数据库,但是在linux上执行程序就报错:
The Network Adapter could not establish the connection
哪位大虾指点一下?
代码很简单
import java.sql.*;
import java.lang.*;
import java.util.*;
class testDB{
public static void main(String arg[]){
try{
Class.forName("oracle.jdbc.driver.OracleDriver&quot

;
Connectionc = DriverManager.getConnection("jdbc

racle:thin:@192.168.0.13:1521:goldgis","goldgis","goldgis&quot

;
Statement s = c.createStatement();
ResultSet r = s.executeQuery("select * from 成都_公交车站 order by 途经车次,站序号&quot

;
while(r.next()){
System.out.println(r.getString(1));
}
}catch(Exception e){
System.out.println(e.toString());
}
}
}
回复

使用道具 举报

千问 | 2015-11-11 09:58:34 | 显示全部楼层
The Network Adapter could not establish the connection
127.0.0.1
回复

使用道具 举报

千问 | 2015-11-11 09:58:34 | 显示全部楼层
把你LINUX上配置TOMCAT+JDK嗎?
配置正确嗎?
回复

使用道具 举报

千问 | 2015-11-11 09:58:34 | 显示全部楼层
你的DATABASE SERVER中的TNSNAMES.ORA和LISTENER.ORA中的HOST=IP
不要用電腦名稱
改過嗎?
如果你用TOMCAT
那你的SERVER.XML文件配置正确嗎?
檢查一下
回复

使用道具 举报

千问 | 2015-11-11 09:58:34 | 显示全部楼层
oracle.jdbc.driver
文件放路徑正确嗎?
回复

使用道具 举报

千问 | 2015-11-11 09:58:34 | 显示全部楼层
改回专有服务器模式后一切正常了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行