• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading excel file

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anybody tell me how to read an excel file stored in the client machine thru a servlet and populate the datas to the db .
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the coding abt to read excel sheet shell by sheel and and store the Database (oracle). using jsp,servlet,VO
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interpreting an EXCEL file in Java can be done with the HSSF toolkit from the Apache POI project.
Bill
 
Sundar Gopal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
thanks for your response. i used poi only to generate the excel file and i send it to client with a URL in it. the client after modifying the excel when he cliks the url has to update the modified data to the db. this is the scenario.
if i use HSSS i am not getting the values in the excel from the client side since i cannot load the file from the client and read it.
i am having a java class which reads the data good. but if i access the class via servlet its not working. my java class is like this........

package excel;

/**
* @author gsundar
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/


import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.DriverManager;

public class ExcelReaderClass{
public static void main( String [] args )
{
Connection c = null;
Statement stmnt = null;
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
c = DriverManager.getConnection( "jdbc dbc:Report_sheet");
stmnt = c.createStatement();

String table = "Report_Sheet$";

String query = "select * from" +"\"" + table + "\"";
ResultSet rs = stmnt.executeQuery(query);

System.out.println( "Found the following in the excel:" );
while( rs.next() )
{
System.out.print( rs.getString(1)+" " );
System.out.print( rs.getString(2)+" " );
System.out.print( rs.getString(3)+" " );
System.out.print( rs.getString(4)+" " );
}
}
catch( Exception e )
{
System.err.println( "Exception in class :"+e );
}
finally
{
try
{
stmnt.close();
c.close();
}
catch( Exception e )
{
System.err.println("Exception in connection close() :"+ e );
}
}
}
}
 
Sundar Gopal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but the above java class also works only if i configure datasource in my system for the excel file so that each worksheet will be like a table. this is not the solution i am searching for. i am in need of a better solution. your valueble inputs highly appreciated...
reply
    Bookmark Topic Watch Topic
  • New Topic