Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this is my present code
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- // String fieldName = fi.getFieldName();
- // String fileName = fi.getName();
- // String contentType = fi.getContentType();
- //boolean isInMemory = fi.isInMemory();
- //long sizeInBytes = fi.getSize();
- String filename1="index";
- Connection con = null;
- Statement stmt = null;
- try
- {
- response.setContentType("text/html");
- PrintWriter out = response.getWriter();
- MultipartRequest m=new MultipartRequest(request,"d:/new");
- out.print("successfully uploaded");
- Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
- "databaseName=upload;user=sa;password=123;";
- con = DriverManager.getConnection(connectionUrl);
- stmt=con.createStatement();
- //String sql = "INSERT INTO uploaded (filename) values (?)";
- // PreparedStatement statement = con.prepareStatement(sql);
- // statement.setString(1,filename1);
- //String sql = "INSERT INTO uploaded VALUES ('"filename1"')";
- stmt.executeUpdate("INSERT INTO uploaded " +
- "VALUES (1001)");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement