Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Error in reading Excel data using jsp even having .xls and POI Library in respective folders

Have Programming Question? Ask it here!
 
 
 


B.sucharitha
Error in reading Excel data using jsp even having .xls and POI Library in respective folders
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners


Hi,

hello.xls and POI library files are there in respective folders. the printStackTrce() method shows the following Error message on console.

java.io.IOException: Invalid header signature; read 576460838270094160, expected -2226271756974174256 at org.apache.poi.poifs.storage.HeaderBlockReader.(HeaderBlockReader.java:88) at org.apache.poi.poifs.filesystem.POIFSFileSystem.(POIFSFileSystem.java:83) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:230) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:211) at org.apache.jsp.AdminSaaS.excelreadingjsp.jspService(excelreading_jsp.java:71) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:495) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595)


Advertisement
View Answers

February 28, 2011 at 3:48 PM


Read excel using jdbc:

Follow these steps:

1)Go to the start->Control Panel->Administrative Tools-> data sources.

2)Click Add button and select the Drive do Microsoft Excel(*.xls).

3)After selecting the driver, click finish button.

4)Then give Data Source Name,select drive, directory and excel file to be read and click ok button.

5)Your DSN will get created.

6)Then run the following code:

<%@page import="java.sql.*"%>
<table>
<tr><td>Name</td><td>Address</td></tr>
<%
try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con = DriverManager.getConnection("jdbc:odbc:excel");
         Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery("select  * from [sheet$]");
         while (rs.next()){
            %>
        <tr><td><%=rs.getString(1)%></td><td><%=rs.getString(2)%></td></tr>
        <%
        }

}
catch(Exception e){
System.out.println(e);
}
        %>


Related Tutorials/Questions & Answers:
Error in reading Excel data using jsp even having .xls and POI Library in respective folders
Error in reading Excel data using jsp even having .xls and POI Library in respective folders  Hi, hello.xls and POI library files are there in respective folders. the printStackTrce() method shows the following Error message
Error in reading Excel data using jsp
Error in reading Excel data using jsp  ERROR while executing bellow... and POI library files are there in respective folders. the printStackTrce...: drive?If not then create it.Anyways do you have POI library in the lib folder
Advertisements
Read Simple Excel(.xls) document using Apache POI
Read Simple Excel(.xls) document using Apache POI In this section, you will learn how to read Excel file having .xls extension using Apache POI library. In the below example, we will read excel document having one sheet named as "
Create Simple Excel(.xls) document using Apache POI
Create Simple Excel(.xls) document using Apache POI In this section, you will learn how to create a Simple Excel sheet having .xls extension using Apache POI library. In the given below example, we will going to create a simple excel
excel sheet reading and using that data - JSP-Servlet
excel sheet reading and using that data  i have to do a read a excel... to send mail to those employees how to do in jsp sir please help me sir.. Thanks...://www.roseindia.net/tutorial/java/poi/readExcelFile.html http
create folders and sub folders based on excel data
create folders and sub folders based on excel data  Hi, i have a requirement that , read the data from excel sheet and based on that data i need to create folders and subfolders. here the excel sheet looks like
Read Excel(.xlsx) document using Apache POI
Read Excel(.xlsx) document using Apache POI In this section, you will learn how to read Excel file having .xlsx extension using Apache POI library. In the below example, we will read excel document having one sheet named as "new
Create Excel(.xlsx) document using Apache POI
Create Excel(.xlsx) document using Apache POI In this section, you will learn how to create a Excel sheet having .xlsx extension using Apache POI library. In the given below example, we will going to create excel document having one
Apache POI Excel Maximum Row - JSP-Servlet
Apache POI Excel Maximum Row  I am using Apache POI lib for export jsp results to excel file. I am getting error : Row number must be between 0... row value ? and How can I change that ? Thanks in advance Regards
How to read every cell of an excel sheet using Apache POI and insert those data into a DB?
How to read every cell of an excel sheet using Apache POI and insert those data into a DB?   i have an excel sheet, whose data in each cell has to be read and those data has to be inserted in the DB. This has to happen for all
reading data using struts and jsp java
reading data using struts and jsp java  how can i read data entered by user into a textbox (jsp page) into struts action class ex emp id,so that after reading emp_id it can be read into struts action class for retrieving other
Excel Created using POI and HSSF - Development process
Excel Created using POI and HSSF  Hi i ceated excel file using jakarta poi library i want to add Percentage formula to cell i am not able to do that can you please suggest me how do i add formula c3.setCellValue("Percentage
Reading excel via JSP
Reading excel via JSP   The problem is while reading cells values which all are having "space" between the word, I can read only till space after... the space between words and get full cell value? I am reading the value
How to read a rows which have a values in a excel file using apache poi - JSP-Servlet
How to read a rows which have a values in a excel file using apache poi  Dear sir, How to read excel file in that only a rows which are having some values using apache poi...please help me sir. Thanks and Regards
Java sdk/java poi hssf code to creat excel with folder structure,( i,e folders, subfolders and childrens )
Java sdk/java poi hssf code to creat excel with folder structure,( i,e folders... in the excel file . To be precise, am working on Java sdk of business objecsts . i need some help in getting folder structure using this java . Folder
Need to remove duplicated rows from excel using apache POI API
Need to remove duplicated rows from excel using apache POI API  Hi, Need help from you. I am able to generate excel sheet with data also... to remove duplicated rows from excel sheet by using apache poi api oe jxl api
Set Data Format in Excel Using POI 3.0
Set Data Format in Excel Using POI 3.0       In this program we are setting data format in excel file using Java.  POI version 3.0 provides a new feature for manipulating
Apache POI API for Microsoft Doc's Manipulation
; of Microsoft excel Documents : Create Simple Excel(.xls) document using Apache POI  Read Simple Excel(.xls) document using Apache POI...(.xlsx) document using Apache POI Read Excel(.xlsx) document using Apache
Built in Data Format in Excel Using POI 3.0
Built in Data Format in Excel Using POI 3.0  ... in format for formatting our data in excel sheet.  POI version 3.0 provides... OLE 2 Compound Document format using Java .POI version 3.0 APIs provides
How to hide text in Word Document using Apache POI library
How to hide text in Word Document using Apache POI library  Is it possible to hide text in MS Word Document using Apache POI library? If yes, please let me know how. I am able to create and read the document using POI library
reading data from excel file and plotting graph
that reads an excel file using POI api and using the data of excel file...reading data from excel file and plotting graph  I am doing a project using NetBeans in which i have to take input an excel file and then using
Excel Data validation
Excel Data validation In this section, you will learn how to validate data in a excel's cells using Apache POI. Using Apache POI library, you can restrict value entered in a excel sheet's cell. User can enter only specified
How to set background of an excel sheet using POI - Java Magazine
How to set background of an excel sheet using POI  Hi, i am trying to format the excel using java. How to set the background color of an excel... using POI: For read more in details to visit.... http
Err while reading CSV file using POI - Java Beginners
Err while reading CSV file using POI  Hi, When i am trying to read a CSV file using POI Dile system, the below error is coming up... URL url = this.getServletContext().getResource("/data_feeds/Demo.csv
How to export data from jsp to excel sheet by using java
How to export data from jsp to excel sheet by using java   How to export data from jsp to excel sheet by using java
Read Excel data using JSP and update MySQL databse
Read Excel data using JSP and update MySQL databse  HOw to read excel data using JSP and update MySQl database
Edit word document Headers and Footers using POI Library in java?
Edit word document Headers and Footers using POI Library in java?  Hi All, I need code to modify the Header and Footer contents of a ms-word template using POI or JACOB libraries. Could any one help me? Thanks Advance
Format Cell of Simple Excel Sheet(.xls)
Format Cell of Simple Excel  Sheet(.xls) In this section, you will how to format the cell of a simple excel sheet having extension .xls. In the below example, we will create second cell of first row having applied style
Java Read .doc file using POI library
Java Read .doc file using POI library In this section, you will learn how to read the word document file using POI library. The class HWPFDocument throw all of the Word file data and the class WordExtractor extract the text from
Read data from excel file and update database using jsp
Read data from excel file and update database using jsp  read data from excel file and update database using jsp Hi, I am using a MySQL database... upload excel file and update database using JSP ? Thanks in Advance
jsp data in excel - JSP-Servlet
in jsp using table. and getting this data from servlet which has query and this query data has come from beans and using beans i put it in excel jsp in table...jsp data in excel  i have create jsp page which has button
insert data 50 row *column into 300 row *column by using xls sheet data (50 row *column) are given in xls sheet
insert data 50 row *column into 300 row *column by using xls sheet data (50 row *column) are given in xls sheet   1- there are matrix of data with 300 row and 300 column,this is master table we have input data 50 row and 50
Drawing a Shape in Excel Sheet
Drawing a Shape in Excel Sheet In this section, you will learn how to draw a shape in excel sheets using Apache POI library. Using Apache POI, you can draw...; Secondly, for positioning the shape on the excel sheet , create an anchor. Use
Uploading Excel sheet record in JSP to insert data in MySql
Uploading Excel sheet record in JSP to insert data in MySql  Need Help how to upload Excel (.xls) file and insert data in Mysql using JSP it wil be wonder for me if any help me
Apache POI Excel creation - Development process
Apache POI Excel creation  Hi i am creating Excel sheet using Apache POI. i could able to generate Excel sheet and saving it in mentioned physical...; Hi friend, Code to help creating excel sheet using POI
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to read data from excel file through browse and insert into oracle database using jsp or oracle???  sir.. i have number of excel sheets which...://www.roseindia.net/answers/viewqa/JSP-Servlet/28123-write-excel-file-into-the-oracle
uploading and reading the excel daa
uploading and reading the excel daa  uploading the excel file not getting the data of the excel
how to create xls file and give download option using jsp/servlet?
how to create xls file and give download option using jsp/servlet?  Hi, how to create file and give download option to user,so that the user can save the file on defined path
Excel - JSP-Servlet
Excel  How to export data from jsp to excel sheet. I am using struts1.2 in my application.  Hi friend, Code to data from Jsp to excel...: "success.jsp" For more information on excel sheet Using JSP visit
reading excel sheet in java
reading excel sheet in java  can anyone tell me a proper java code to read excel sheet using poi   Here is a java code that reads an excel file using POI api and display the data on the console. import java.io.
xls to js using javascript
xls to js using javascript  ![how can we convert a xls file in js file using javascript][1
read excel data from jsp - JSP-Servlet
read excel data from jsp  Hi how to read excel file from jsp? Excel file is created manually entered data having many sheets? and read the entire sheet and also edit with jsp? pls suggest me?   Hi Friend, 1
Insert data in Excel File from Database using JSP
Insert data in Excel File from Database  using JSP ... developed a application to insert data  in excel file from database in JSP. We... the data from database, create an excel file and data insert into newly
update excel sheet using jsp::
update excel sheet using jsp::   Hi Sir,... I have a excel... given excel sheet and display it into another excel sheet using jsp" i am using 'session' to get the empid from one page to another jsp
Error in POI - Java Beginners
Error in POI  Hi friend, I am working with Excel using POI API.I need to read an excel file and do some modifications and save this file into different location. Along with this I need to remove the extra sheets which
Need to remove duplicate rows from the Excel Sheet using the Apache POI API
Need to remove duplicate rows from the Excel Sheet using the Apache POI API   Hi There, Is any one aware of java code on how to find the duplicate rows in excel.I am using the Apache POI API to achieve the same have googled
reading data from a text box with the same name using servlets - JSP-Servlet
reading data from a text box with the same name using servlets  Hello sir, i want to get the values from four textboxes having the same name like a= b= c= using servlet i want to print all the values from each text
jsp with excel sheet data uploading into database
jsp with excel sheet data uploading into database  how to upload data in excel sheet with jsp into oracle 10g database
how to convert a .xlsx to .xls fil - JSP-Servlet
how to convert a .xlsx to .xls fil  Dear sir, How to convert a .xlsx file to .xls using poi .Please give me some clue.... Thanks in advance
jsp to excel - JSP-Servlet
jsp to excel  Hi All, I'm writing a program of jsp to Excel conversion with Using POI. My problem is i'm unable to put multiple data into excel...)); } FileOutputStream fileOut = new FileOutputStream("c:\\excel\\wct.xls
Advertisements
 

 

 

DMCA.com