<body> <% Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn=null; String user=request.getParameter("userName"); String password=request.getParameter("password"); try { conn =DriverManager.getConnection("oracle.jdbc.driver.OracleDriver",user,password); out.write("连接成功!"); Statement st = conn.createStatement(); st.close(); //管理连接 conn.close(); } catch (Exception e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } %> </body>
<body> <form name=‘frm‘ action=‘dengru.jsp‘> 用户名:<input type="text" name="userName"> 密码:<input type="password" name="password"> <input type="submit" value="确定"> </form> </body>
时间: 2024-10-13 13:07:16