如何在Java中存储数据?数据库? [英] How to store data in Java? Database?

查看:186
本文介绍了如何在Java中存储数据?数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个我想要存储,检索,排序和搜索数据的应用程序。我使用Java和我有GUI和一些功能书面已经,但我不知道如何存储数据在Java。我在为Android手机编写应用程序时,已经对SQLite做了很多工作,并且正在寻找类似这样的东西。

I am writing an application that I want to store, retrieve, sort, and search data. I am using Java and I have the GUI and some functionality written already but I have no idea how to store data in Java. I have done a VERY little bit of work with SQLite when I was writing an app for my android phone and was looking for something like that maybe.

我需要存储信息其彼此链接,例如想到地址簿。名称,地址,电话号码,电子邮件地址等将彼此链接并且在地址簿中一起进入一个条目。同样,我需要以这种方式存储大量的数据,并能够搜索所需的数据。我还希望能够以能够获取name的地址值的方式检索数据。

I need to store information that is linked to each other, for example think of an address book. The name, address, phone number, email address, etc. would be linked to each other and go together for one entry in the address book. Similarly I need to store a large amount of data in this way and be able to search it for needed data. I would also like to be able to retrieve the data in a fashion that I could get the address value for "name".

我需要知道最简单的方法来完成这个。在googleing之后,我发现了关于Java DB的信息,但我不知道这是否正是我正在寻找或如何使用它。

I need to know the easiest way to accomplish this. After googleing it I found information on Java DB but I don't know if this is exactly what I am looking for or how to use it.

请回答提供我有关如何使用存储数据的信息,如果可能,请指导我如何使用它的教程。

Please answer by providing me with information on what to use to store the data and if possible point me in the direction of a tutorial on how to use it.

-------- - - - - - - - - - - - - - - - -编辑 - - - - - - - - - --------------------------

---------------------------------------EDIT--------------------------------------------

我很感激帮助,但我还是没有得到它。我想使用SQLite,我跟着链接,克里斯蒂安·安通给了,我下载了SQLiteJDBC的东西,但现在我迷路了。我很清楚在这里的新领域,并完全失去了。

I appreciate the Help but I am still not getting it. I want to use SQLite and I followed the link that Kristian Antonsen gave and I downloaded the SQLiteJDBC thing but now I am lost. I am clearly in new territory here and completely lost.

有人可以给我一个白痴指南如何使用,使其在我的应用程序中工作? p>

Can someone give me an "idiots guide" on how to use this and make it work in my application?

推荐答案

有很多方法可以实现这一点,下面是一些

There are lots of ways to accomplish this, here's a few

  • Use a SQLite database (recommended).
  • Convert your objects to XML (Xstream) and store them as XML files.
  • Serialize your data objects and save them to a file.

这篇关于如何在Java中存储数据?数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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