* Execute an INSERT statement and pass parameters * / create or replace procedure p_test2 (i in number) AsbeginInsert Into T Values (i, 'x' || to_CHAR (i)); commit; end; /
<% @ page language = "java" contenttype = "text / html; charset = GB2312"%> <% @ page import = "java.sql. *"%>
< TD> AAA TD> BBB TD> TD> <% String Driver = "Oracle.jdbc.driver.Oracledriver"; string strurl = "JDBC: Oracle: Thin: @ 192.168.1.6: 1521 : db "; class.forname (driver); connection conn = drivermanager.getConnection (Strurl," Scott "," Tiger ");
String procedure = "{call p_test2 (?)}; Callablestatement cstmt = conn.prepareCall (procedure); cstmt.setint (1,33); cstmt.executeUpdate ();
Statement Stmt = Conn.createStatement (); ResultSet RS = Stmt.executeQuery ("SELECT * from T");
While (rs.next ()) {OUT.Println ("
" rs.getstring (1) td> " rs.getstring (2) " TD > TR> ");}
rs.close (); stmt.close (); conn.close ();%> table>
<% out.print (conn.isclosed ());%>
body> html> body> html>
转载请注明原文地址:https://www.9cbs.com/read-124147.html