oracle连接问题
package netbar;
import oracle.jdbc.*;
import java.sql.*;
public class Test {
public static void main(String[] args) {
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url="jdbc:oracle:thin:@192.168.0.211:1521:netbardb";
String user="system";
String passwd="manager";
Connection conn =DriverManager.getConnection(url,user,passwd);
System.out.println("succ");
}catch(Exception e){
//System.out.println("无法连接数据库!");
e.printStackTrace();
}
//获得连接
}
}
抱错:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at netbar.Test.main(Test.java:14)
高手指点!!!!!
问题点数:20、回复次数:3Top
1 楼javapro(microft_hating)回复于 2002-07-16 18:47:07 得分 20
Sorry,something wrong with my computer ,I can only write in English.
I meet the same problem before,perhaps there a firewall in the computer where the oracle server locate ,and the firewall resist the connection from your program to the server.
Top
2 楼mycode(不写代码)回复于 2002-07-20 11:54:54 得分 0
我不懂Java.
想知道,在本机用system/manamger@netbardb能连上数据库吗?Top
3 楼Brain(无缺公子)回复于 2002-07-20 12:36:24 得分 0
你没能连上数据库,很简单的
你用楼上的方法
用oracle的客户端连一下看能否连上oracle服务器
如果不行
那么你看一下你能否连上oracle服务器所在的机器
Top




