Java application that can run entirely from a DVD

2019-07-09 08:56发布

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?

Thanks in advance. Nick Tsilivis

2条回答
forever°为你锁心
2楼-- · 2019-07-09 09:35

That sounds like a job for SQLite. It runs completely in your own process, so there is no need to start an external database server.

查看更多
别忘想泡老子
3楼-- · 2019-07-09 09:39

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, ...

You must have installed SQLite on your system SQLite Download

查看更多
登录 后发表回答