如何从XML文件中读取数据并将其存储到数据库(MySQL)中? [英] How to read data from an XML file and store it into database (MySQL)?

查看:1122
本文介绍了如何从XML文件中读取数据并将其存储到数据库(MySQL)中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从XML文件中获取数据并将其存储到MySQL数据库中。我正在考虑使用SAX Parser来解析数据,但我不确定如何有效地将数据存储到数据库中,我想的是像 JDBC Hibernate 但是我想问一下这样做的有效方法是什么?

I need to get data from an XML file and store it into a MySQL Database. I am thinking of using a SAX Parser for parsing the data but I am not sure of how to store data efficiently into database, I am thinking of few technologies like JDBC and Hibernate but I wanted to ask about what would be the efficient way of doing it?

注意:这里的编程语言是Java。

Note: Here programming language is Java.

推荐答案

您可以使用 Castor 女巫是一个开源数据用于将数据从
XML移动到Java编程语言对象以及从Java移动到
数据库的绑定框架。

You could use Castor witch is an open source data binding framework for moving data from XML to Java programming language objects and from Java to databases.

我在 IBM developerWorks 使用适合您需求的Castor。

I found also article series in IBM developerWorks that describe using Castor suited to your needs.

这篇关于如何从XML文件中读取数据并将其存储到数据库(MySQL)中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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