简体   繁体   English

带数据库的java桌面应用程序

[英]Desktop application in java with database

I am trying to implement an application for a friend who sells t-shirts and hats, so we are dealing with interconnected tables. 我正在尝试为销售T恤和帽子的朋友实施一个应用程序,因此我们正在处理互连的表格。 I was wondering what would be the perfect libraries to achieve this goal. 我想知道实现这一目标的完美库是什么。 What kind of database should I use to make it portable and easy to deploy. 我应该使用什么样的数据库来使其便携且易于部署。 I would really like to insist on the database stuff, what should I use? 我真的想坚持数据库的东西,我应该用什么?

Thank you so much (I use Netbeans) 非常感谢你(我使用Netbeans)

It seems like it needs to go production. 看起来它需要投入生产。 Better go for H2 , its a better, faster HSQLDB. 更好的是H2 ,它是一个更好,更快的HSQLDB。

Check out Hypersonic and Derby . 查看HypersonicDerby They are embedded databases that store their data in a simple file so you don't have to worry about installing and managing a complex system like mysql or postgres or sql server. 它们是嵌入式数据库,可将数据存储在一个简单的文件中,因此您无需担心安装和管理mysql或postgres或sql server等复杂系统。 They work with the regular jdbc front end. 他们使用常规的jdbc前端。

Here is a Java binding for SQLite. 是SQLite的Java绑定。 SQLite is very lightweight and should suit your needs very well. SQLite非常轻量级,非常适合您的需求。

A nice database editor is also a godsend. 一个不错的数据库编辑器也是天赐之物。 I recommend SQLite Manager , a Firefox plugin, when working with SQLite. 在使用SQLite时 ,我推荐使用SQLite Manager ,一个Firefox插件。

For the engine, look into embedded databases like sqllite, derby and hsqldb 对于引擎,请查看sqllite,derby和hsqldb等嵌入式数据库

For the integration you can either keep it simple and use plain old JDBC which will make things easier to an extent or go the Hibernate or JPA way 对于集成,您可以保持简单并使用普通的旧JDBC,这将使事情更容易,或者采用Hibernate或JPA方式

We used HSQLDB initially for a similar application . 我们最初使用HSQLDB用于类似的应用程序。 But after going to production with it some of the users experienced random data corruption ( look though their forum, it seems like a common issue ), So we switched to Derby which proved to be stable . 但是在用它生产后,一些用户经历了随机数据损坏(看看他们的论坛,这似乎是一个常见的问题),所以我们切换到Derby,证明是稳定的。 So my vote is Derby . 所以我的投票是德比。

Also, I would stay away from hibernate for desktop applications due to huge startup time (it has to prepare the metadata upfront ), unless you only have few tables / models. 此外,由于启动时间很长(我必须提前准备元数据),我会远离桌面应用程序的休眠状态,除非你只有很少的表/模型。

I would use Hibernate (or JPA) in order to create a standard mapping between the relational database and the object oriented java design. 我会使用Hibernate(或JPA)来创建关系数据库和面向对象的java设计之间的标准映射。

As far as databases are concerned I often use MySql or Oracle XE which are free and robust enough for your purposes. 就数据库而言,我经常使用MySql或Oracle XE,它们是免费且足够强大的。

你也可以使用SQLite

You can use Firebird with JayBird 你可以将FirebirdJayBird一起使用

Firebird is free, very easy to install and setup with good backup Firebird是免费的,非常容易安装和设置好备份

Another option is Perst, an open source, object-oriented database that is 100% Java. 另一个选项是Perst,一个开源的,面向对象的数据库,它是100%Java。

For info on Perst, see www.mcobject.com/perst. 有关Perst的信息,请访问www.mcobject.com/perst。

You can download Perst, with source code, at www.mcobject.com/perst_eval. 您可以在www.mcobject.com/perst_eval下载包含源代码的Perst。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM