问题描述
我必须创建一个完全从DVD运行的java应用程序。应用程序必须连接到也将在DVD上的数据库。我想用一个嵌入式数据库,但我不知道他们。我必须从我的java应用程序启动数据库服务器,如果我这样做,我该怎么办?
I have to create a java application that can run entirely from a DVD. The application must connect with a database that will be also on the DVD. I was thinking to use an embedded database but i dont know much about them. Do i have to start the database server from my java application and if i do, how should i do it?
提前感谢。
Nick Tsilivis
Thanks in advance.Nick Tsilivis
推荐答案
您可以使用 SQLite
一个非常轻的加权版本的SQL。它将数据存储在单个文件中。您甚至不必使用用户名和密码登录。只需添加此jar 到你的项目构建路径。您可以通过以下方式访问它:
You can use SQLite
which is a very light weighted version of SQL. It stores its data in a single file. You even don't have to log in with an username and password. Just add this jar sqlite-jdbc to your projects build path. You cann access it by following:
Class.forName("org.sqlite.JDBC");
Connection connection = DriverManager.getConnection("jdbc:sqlite:your_database.db"); //"your_database.db" is the SQLite database file on your DVD.
/*manipulate your db by using PreparedStatement, ResultSet, ...
您必须在系统上安装SQLite
You must have installed SQLite on your system SQLite Download
这篇关于可以完全从DVD运行的Java应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!