存取的格式是 .xls 得格式, 像 xlsx 的格式沒試過不過應該不行吧。
以下是他的相關連結
- 介紹: http://www.andykhan.com/jexcelapi/
- 載點:http://www.andykhan.com/jexcelapi/download.html
- 範例:http://www.andykhan.com/jexcelapi/tutorial.html
Licence: 是GPL的喔
<Resource name="jdbc/myoracle" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@127.0.0.1:1521:mysid"
username="scott" password="tiger" maxActive="20" maxIdle="10"
maxWait="-1"/>
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
...
<%@page import="java.util.*, javax.naming.*, java.sql.*, javax.sql.*"%>
...
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
String sql = "";
ResultSet rs = null;
Use db
sql = "SELECT * FROM TABLE";
rs = smt.executeQuery(sql);
while(rs.next())
{
out.println(rs.getString("ID"));
out.println(rs.getString());
out.println("");
}
con.close();