如何使用Java中的ODBC将Excel文件导入MySQL? [英] How to import an Excel file into MySQL using ODBC in Java?

查看:167
本文介绍了如何使用Java中的ODBC将Excel文件导入MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ODBC驱动程序将Excel文件导入MySQL数据库。 Java是否支持这种技术?如果是,请指导我如何实现这一点。

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.

推荐答案

您可以使用Apache POI库在Java中读取Excel文件: http://poi.apache.org/
他们的howto页面上有一些代码示例它将告诉您如何阅读Excel文件: http://poi.apache.org/电子表格/操作方法

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

要存储数据,最好使用JDBC驱动程序而不是ODBC,因为ODBC依赖于本地图书馆。您可以在此处获取连接器: http://www.mysql.com/products/connector/

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/

如果你绝对必须使用ODBC,那么你可以在这里看到如何做到这一点: http://download.oracle.com/javase/1.5.0/docs/guide/jdbc/bridge.html

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

这篇关于如何使用Java中的ODBC将Excel文件导入MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆