Java application that can run entirely from a DVD

霸气de小男生 提交于 2019-12-11 03:27:04

问题


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


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/13416346/java-application-that-can-run-entirely-from-a-dvd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!