-1

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?

3
  • I just created that application experimentally...just to check whether it's possible or not. Commented Aug 31, 2013 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). Commented Sep 1, 2013 at 9:39
  • Where is code ? Commented Sep 18, 2017 at 6:09

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

2 Comments

how to achieve that(create table if does not exist) ?...could u elaborate that?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.