I have developed a demo application in java.It has a simple log-in screen that has username and password fields.Now,i am using sqilte for the purpose.I am able to log in to by connecting to the predefined database.But i want to run the application in a different machine with successful log in.For this purpose I want to create a database in the different machine automatically from the application if it does not exist.For that I want to package the application in to an executable installer and install in a different machine and run it.Sqlite being an embedded database what is the exact solution to it?
Asked
Active
Viewed 466 times
0
-
I just created that application experimentally...just to check whether it's possible or not. – user2735799 Aug 31 '13 at 16:36
-
You can reword this question to ask how you include a SQLite database as part of your Java application, i.e. how to package it and where the file should be located (etc). – Ben Sep 01 '13 at 09:39
-
Where is code ? – Hardeep Singh Sep 18 '17 at 06:09
2 Answers
1
Just include a default/sample SQLite database file in your installer package or application. SQLite isn't magic, it's just a file on the filesystem.
From: Creating Database in JDBC Sqlite
The SQLite JDBC string you're using contains the filename of the file you should copy:
jdbc:sqlite:filename.db
The file filename.db
will be in your application's working directory.
0
Take a look at Creating Database in JDBC Sqlite.
Then you can use create table if not exist to create your tables and relations.

Community
- 1
- 1

JackTools.Net
- 734
- 6
- 13
-
how to achieve that(create table if does not exist) ?...could u elaborate that? – user2735799 Aug 31 '13 at 16:42
-
http://stackoverflow.com/questions/4098008/sqlite-create-table-if-doesnt-exist – JackTools.Net Sep 01 '13 at 16:39