1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.lang.*;
public class SupprimerServlet extends HttpServlet{
public void doGET(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException {
String numero=req.getParameter("number");
res.setContentType("text/plain");
PrintWriter out=res.getWriter();
// Create a variable for the connection string.
String connectionUrl = "jdbc:odbc:logipro";
//integratedSecurity=false;";
// Declare the JDBC objects.
Connection con =null;
ResultSet rs = null;
CallableStatement cstmt=null;
try {
// Establish the connection.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection(connectionUrl,"admindtz","11admin,");
// Create and execute an SQL statement that returns some data.
String SQL ="{call zdtz_suppression_prospect(numero)}";
cstmt= con.prepareCall (SQL);
cstmt.executeUpdate();
//String Sql="select numero From t_prospect";
//cstmt= con.prepareCall (SQL);
//cstmt.execute();
//if (cstmt.execute()=null){
//out.Write("<html><head><title>réponse</title></head>"
//+"<body>Votre requete a été effectuée</body>"
//+"<p><input type="submit" name="Submit" rows"5" value="supprimé une autre offre"></p>"
//System.out.println(rs);
// Iterate through the data in the result set and display it.
//while (rs.next()) {
// System.out.println(rs.getString());
// }
}
// Handle any errors that may have occurred.
catch (Exception e) {
e.printStackTrace();
}
finally {
if (rs != null) try { rs.close(); } catch(Exception e) {}
if (cstmt != null) try { cstmt.close(); } catch(Exception e) {}
if (con != null) try { con.close(); } catch(Exception e) {}
}
}
} |
Partager