我写的代码如下
try {
//Class.forName("oracle.jdbc.driver.OracleDriver");
//用适当的驱动程序连接到数据库,zrxx为数据库的SID
//String url = "jdbc:oracle:[email protected]:1521:zrxx";
Connection con = DriverManager.getConnection(url,"hospital","hiscss");
out.println("dfd");
}
//如果加载时出错,给出相就的错误信息
catch (Exception e) {
out.println(e);
}
try {
//Class.forName("oracle.jdbc.driver.OracleDriver");
//用适当的驱动程序连接到数据库,zrxx为数据库的SID
//String url = "jdbc:oracle:[email protected]:1521:zrxx";
Connection con = DriverManager.getConnection(url,"hospital","hiscss");
out.println("dfd");
}
//如果加载时出错,给出相就的错误信息
catch (Exception e) {
out.println(e);
}
去下载oracle的驱动啊。
--------------------------------------
CSDN 论坛助手 [助您好,快,爽的上CSDN.....]
Http://www.ChinaOK.net/Csdn/
为啥屏蔽?
比如tomcat或者oracle的服务器设置等因为就算驱动老了,但是一般来说都有兼容性的,何况才是一年的时间
good luck!
网络服务器的默认目录指的是什么呢?
我现在安装的是oracle8.1.5
Class.forName("oracle.jdbc.driver.OracleDriver");
//用适当的驱动程序连接到数据库,zrxx为数据库的SID
String url = "jdbc:oracle:[email protected]:1521:zrxx";
Connection con = DriverManager.getConnection(url,"hospital","hiscss");
out.println("dfd");
}
//如果加载时出错,给出相就的错误信息
catch (Exception e) {
out.println(e);
}
就是这段代码
try {
Connection con;
Statement stmt; Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@localhost:1521:orcl";
con = DriverManager.getConnection(url,"system","manager");
}
//如果加载时出错,给出相就的错误信息
catch (Exception e) {
out.println(e);
}
报错“java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection ”
你确信本地数据库端口1521且库名为orcl?