import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.*;
import javax.naming.*;
import java.sql.*;
import java.iol.IOException;public class TestServlet extends HttpServlet
{
private Connection conn; protected void doGet(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException
{
try
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
conn=DriverManager.getConnection("jdbc:db2:mydb","db2","db2");
PreparedStatement stmt=conn.prepareStatement("delete from mytb where id=?");
for(int i=0;i<5;i++{
stmt.setInt(1,i);
stmt.executeUpdate();
}
conn.close;
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
import javax.servlet.http.*;
import javax.sql.*;
import javax.naming.*;
import java.sql.*;
import java.iol.IOException;public class TestServlet extends HttpServlet
{
private Connection conn; protected void doGet(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException
{
try
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
conn=DriverManager.getConnection("jdbc:db2:mydb","db2","db2");
PreparedStatement stmt=conn.prepareStatement("delete from mytb where id=?");
for(int i=0;i<5;i++{
stmt.setInt(1,i);
stmt.executeUpdate();
}
conn.close;
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货