title: Retrieving Clob data from database using Servlet and make that data downloadable in JSP
body: <p>I have requirement where i need to retrieve some set of data, out of which one is CLOB data,may get multiple rows and i need to display each row in JSP page and also provide download option to download this CLOB data as an XML file for every row.</p>
  
  <p>I have no idea how to implement this, below is code which i am using to retrieve the data.</p>
  
  <pre><code>List dataList = new ArrayList();
  
          while(rs.next()){
              RecordData rdata =new RecordData();
              rdata.setId(rs.getInt("OBJID"));    
  
              aclob = (CLOB)rs.getClob("X_MESSAGE");  
              clob_length = (int)aclob.length();  
              rdata.setMessage(aclob.getSubString(1, clob_length));
  
              dataList.add(rdata);
          }
  
  request.setAttribute("dataList", dataList);
  request.getRequestDispatcher("jsp/displayrecords.jsp").forward(request,response);
  </code></pre>