先把jdbc目錄下的classes2.jar 復制到eclipse工程中
<%@ page language="java" contentType="text/html; charset=GB18030"
<%@ page import="java.sql.*,java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>
<%
try {
} catch (ClassNotFoundException e) {
}
try {
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:test","scott","tiger");
Statement sm=conn.createStatement();
} catch (SQLException e) {
}
</body>
</html>
如果輸出不為null的話 就表示已經(jīng)連接上了 oracle
聯(lián)系客服