Advertisement
Guest User

Untitled

a guest
Apr 27th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. this is my present code
  2.  
  3. public void doPost(HttpServletRequest request, HttpServletResponse response)
  4. throws ServletException, IOException {
  5.  
  6.  
  7. // String fieldName = fi.getFieldName();
  8. // String fileName = fi.getName();
  9. // String contentType = fi.getContentType();
  10. //boolean isInMemory = fi.isInMemory();
  11. //long sizeInBytes = fi.getSize();
  12. String filename1="index";
  13. Connection con = null;
  14. Statement stmt = null;
  15.  
  16. try
  17. {
  18.  
  19. response.setContentType("text/html");
  20. PrintWriter out = response.getWriter();
  21.  
  22. MultipartRequest m=new MultipartRequest(request,"d:/new");
  23. out.print("successfully uploaded");
  24.  
  25.  
  26.  
  27. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  28.  
  29. String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
  30. "databaseName=upload;user=sa;password=123;";
  31. con = DriverManager.getConnection(connectionUrl);
  32. stmt=con.createStatement();
  33. //String sql = "INSERT INTO uploaded (filename) values (?)";
  34. // PreparedStatement statement = con.prepareStatement(sql);
  35. // statement.setString(1,filename1);
  36. //String sql = "INSERT INTO uploaded VALUES ('"filename1"')";
  37.  
  38.  
  39. stmt.executeUpdate("INSERT INTO uploaded " +
  40. "VALUES (1001)");
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement