
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.

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);
}
%>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.