开发者

Does SQLiteJDBC can work without SQLite installed, and can it initialize the database tables?

I've tried finding this out on my own but to no avail. I'm writing a Java app that will use an embedded SQLite database through Zentu's SQLiteJDBC.

I am making the following assumptions and need con开发者_StackOverflow中文版firmation on all of them, and where I'm wrong, clarification.

  • For my Swing app to run properly, I will need SQLite installed on each machine that my app is located, and not just the "myEmbeddedDatabase.db" file
  • Best practices would dictate for me to, at installation/deployment time, run a shell script that invokes sqlite and runs a skeleton/init script which creates the tables, etc. that my app will use through SQLiteJDBC; I assume this because it doesn't look like SQLiteJDBC has the ability to read a *.sql file and run it (well, at least not without me doing a lot of coding!)

Thanks to anybody who can help clarify these items for me!


1) No, all you need is a reference to the java driver. This is the appeal of an embedded database system. Some features you would typically find in a full installed database system are missing (such as networking support), but in exchange you don't have to install anything on the client machine.

2) Your best bet is probably to simply create the database schema (table definitions, but not contents) while you're developing. That way you can simply deploy that as a resource with your application and copy it to a suitable folder when your application is first run. Alternatively the java driver will allow you to create the database in code (and add tables to it). Either way, if you update your application you will need to write manual code which checks the version of the database and updates the schema by adding or removing columns/tables as needed.


For my Swing app to run properly, I will need SQLite installed on each machine that my app is located, and not just the "myEmbeddedDatabase.db" file

No. You don't need to do that. SQLite is written for this. It isn't a complete database system that need to be installed (like MySQL). Once you have linked the jdbc driver with your application, you can use your compiled java executable program everywhere.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜