How to import an Excel file into MySQL using ODBC in Java?

好久不见. 提交于 2019-12-04 05:25:15

问题


I want to import an Excel file into a MySQL database using an ODBC driver. Does Java support this technique? If yes, please guide me on how to implement this.


回答1:


You can read an Excel file in Java using the Apache POI library: http://poi.apache.org/ There are some code samples on their howto page which will tell you how to read an Excel file: http://poi.apache.org/spreadsheet/how-to.html

To store the data it would be better for you to use the JDBC driver for MySQL rather than ODBC since ODBC relies on native libraries. You can get the connector here: http://www.mysql.com/products/connector/

If you absolutely must use ODBC, then you can see how to do that here: http://download.oracle.com/javase/1.5.0/docs/guide/jdbc/bridge.html



来源:https://stackoverflow.com/questions/6516705/how-to-import-an-excel-file-into-mysql-using-odbc-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!