给一个简单的JSP连oracle例子
给一个简单的JSP连oracle例子 (用MYECLIPSE,或NETBEANS
------解决方案--------------------
------解决方案--------------------<body>
<%
try{
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("");
while(rs.next()){
//略去
}
con.close();
}catch(Exception e){
e.printStackTrace();
}
%>
</body>
------解决方案--------------------上面那个是mysql的
下面这个是oracle
<body>
<%
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:test","eee","eee");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("");
while(rs.next()){
//略去
}
con.close();
}catch(Exception e){
e.printStackTrace();
}
%>
</body>