title: java.io.FileNotFoundException showing when try to upload excel file in database
body: <p>i'm doing one task where i want to upload excel data in oracle database but when i try to run code and after upload .xls file its giving me file not found exception  D:\GODBFILES\NETBEANS PROJECTS\NetBeansProjects\TestWebApplication\build\web\null (The system cannot find the file specified), <strong>my concern is from any location file should be upload in db</strong> I updated code in fileinputstream im write hard coded path and file name but i dont want this filepath and filename should dynamically fetch and store in file</p>
  
  <p>for uploading file i'm using below jar </p>
  
  <p>commons-fileupload-1.3.jar,
  commons-io-2.4.jar,
  poi-3.9.jar,
  cos.jar,
  poi-ooxml-3.9.xml</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;TODO supply a title&lt;/title&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="f1" enctype="multipart/form-data" action="xlsUpload_01.jsp" method="post"&gt;
              &lt;table align="center" border="1"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Enter File name&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="id"&gt;&lt;/td&gt;
  
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Select File&lt;/td&gt;
                       &lt;td&gt;&lt;input type="file"  name="xlsfile" /&gt;
                  &lt;/tr&gt;
  
              &lt;/table&gt;
              &lt;p&gt;
              &lt;center&gt;
                  &lt;input align="center" type="submit" value="Upload File" name="btnsubmit"/&gt;
              &lt;/center&gt;
  
              &lt;/p&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>xlsupload_01.jsp</p>
  
  <pre><code>    &lt;%@ page language="java" contentType="text/html; charset=UTF-8"
              pageEncoding="UTF-8"%&gt;
           &lt;%@page import="java.sql.*" %&gt;
          &lt;%@page import ="java.util.Date" %&gt;  
          &lt;%@page import ="java.io.*" %&gt;  
          &lt;%@page import ="java.io.FileNotFoundException" %&gt;  
          &lt;%@page import ="java.io.IOException" %&gt;  
          &lt;%@page import ="java.util.Iterator" %&gt;  
          &lt;%@page import ="java.util.ArrayList" %&gt; 
          &lt;%@page import="org.apache.poi.hssf.usermodel.*" %&gt;
          &lt;%@page import ="org.apache.poi.hssf.usermodel.HSSFCell" %&gt;  
          &lt;%@page import ="org.apache.poi.hssf.usermodel.HSSFRow" %&gt;  
          &lt;%@page import ="org.apache.poi.hssf.usermodel.HSSFSheet" %&gt;  
          &lt;%@page import ="org.apache.poi.hssf.usermodel.HSSFWorkbook" %&gt;  
          &lt;%@page import ="org.apache.poi.poifs.filesystem.POIFSFileSystem" %&gt;
          &lt;%@page import="org.apache.poi.ss.usermodel.Cell" %&gt;
          &lt;%@page import ="org.apache.poi.ss.usermodel.Row"%&gt;
          &lt;%@page import="org.apache.poi.ss.usermodel.Sheet" %&gt;
          &lt;%@page import="org.apache.poi.ss.usermodel.Workbook" %&gt;
          &lt;%@page import="com.oreilly.servlet.MultipartRequest" %&gt;
          &lt;%@page import="org.apache.poi.xssf.usermodel.*"%&gt;
          &lt;%@page import="org.apache.poi.xssf.usermodel.XSSFWorkbook"%&gt;
  
           &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
      &lt;!DOCTYPE html&gt;
      &lt;html&gt;
          &lt;head&gt;
              &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
              &lt;title&gt;JSP Page&lt;/title&gt;
          &lt;/head&gt;
          &lt;body&gt;
        &lt;%
  
       ArrayList CellArrayListHolder=new ArrayList();
       Class.forName("oracle.jdbc.driver.OracleDriver");
              Connection con=DriverManager.getConnection("jdbc:oracle:thin:@172.18.114.213:1821:xe","se","Spacess");
  
  
   **FileInputStream file=new FileInputStream(new File("D:\\GODBFILES\\NETBEANS PROJECTS\\upload\\hello.xlsx"));
  XSSFWorkbook workbook=new XSSFWorkbook(file);**
  
      Sheet firstSheet=workbook.getSheetAt(0);
      Iterator&lt;Row&gt; iterator=firstSheet.iterator();
      int count=0;
      while(iterator.hasNext())
      {
          XSSFRow nextrow=(XSSFRow)iterator.next();
          ArrayList rowarraylist=new ArrayList();
          Iterator&lt;Cell&gt; cellIterator=nextrow.cellIterator();
  
          while(cellIterator.hasNext())
          {
              XSSFCell cell=(XSSFCell)cellIterator.next();
              rowarraylist.add(cell);
          }
          CellArrayListHolder.add(rowarraylist);
      }
             out.println(CellArrayListHolder);
             ArrayList rowarraylist=null;
             PreparedStatement st=con.prepareStatement("insert into DYNAMIC_INSERT values(?)");
  
      for(int i=1;i&lt;CellArrayListHolder.size();i++)
      {
          rowarraylist=(ArrayList)CellArrayListHolder.get(i);
          st.setString(1, rowarraylist.get(0).toString());
          //st.executeUpdate();
          count=st.executeUpdate();
  
      }
      if(count&gt;0)
      {
             out.println("&lt;script type=\"text/javascript\"&gt;");
         out.println("alert('File added');");
         out.println("&lt;/script&gt;");    
      }
  
  
  
  
        %&gt;
          &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>