日期:2014-05-18  浏览次数:20783 次

请帮忙看看,将EXCEL导入到MYSQL数据库,是否可以?
<%@page   contentType= "text/html;charset=GB2312 "%>

<%@   page   import= "java.sql.ResultSet "   %>
<%@   page   import= "org.gjt.mm.mysql.Driver.* "   %>
<jsp:useBean   id= "db "   class= "dingshi.db "   scope= "request "/>
<jsp:setProperty   name= "db "   property= "* "/>
<%

java.lang.String   strSQL;  

strSQL= "insert   into   zhangdannow   ([username],   [usermobile],   [mobile],   [riqi],   [shijian],   [neirong],   [jieshou])Select   [1],   [2],   [3],   [4],   [5],   [6],   [7]FROM   OpenDataSource(   'Microsoft.Jet.OLEDB.4.0 ', 'Data   Source= "C:\Book1.xls ";User   ID=Admin;Password=;Extended   properties=Excel   5.0 ')...[Sheet1$]
";
db.executeUpdate(strSQL);  
 
%>  


这个思路是否可以?如果可以insert语句应该如何写?

------解决方案--------------------
先读入到内存,再写入数据库