-2

I want to create a java application which will use Sq Lite database and after making jar file my application will read and write Sq lite database file. So how to achieve this.... please give me overview how to access Sq lite database file and modify it. after making jar file.

15
  • 1
    You should tell us more about your IDE what structure you want to store and more about the whole scenario. Is the DB already there ? Besides that there should be answers to your question that can be found by searching Commented Jun 13, 2015 at 17:18
  • 1
    It would improve your question if you were more clear about which of these things you already know how to do. If you don't know how to do any of these things, then asking how to do all of them at once isn't a good question for StackOverflow. Search for and read some tutorials, and when you get stuck and have specific questions, you can ask each of those here. Commented Jun 13, 2015 at 17:30
  • 2
    Sir I have made a typing speed game and in order to save and load the score i use Scanner and Formatter for reading and writing the text file. So when the jar file of my program is created then it will create text file near to it. So that text file is used to save and load the score of the game. So now I want to use database to save and load the score instead of text file. So when any user play my game his score should be saved in the database and should be load from the database. Commented Jun 14, 2015 at 9:22
  • 2
    Moreover as Jar File can not be modified so database file should be placed outside the jar just like text file. And I want to use SQLite database but I do not know where to place SQLite database file so that when I make Jar file of my project, my application should access that database file and can modify it. So please guide be where i should place that database file. Commented Jun 14, 2015 at 11:18
  • 2
    @Marged i use eclipse IDE and score of the game should be stored in table format consist of 3 columns such that (1. playername playerscore) and Firstly database file should be empty it does not contain any data when user play game his score will be save and when the next time he play the game his saved score should be displayed. I myself can save and load the score through the code but I need guidance of where to put the database file so that it can be access able and modifiable by the jar file. Commented Jun 14, 2015 at 11:22

1 Answer 1

4

It is very simple just place the Sqlite Database file inside your project folder and then in your program in order to connect to the database file create the connection like

connection = DriverManager.getConnection("Jdbc:sqlite:name of your sqlite database file");

Now in order to connect to the database file after creating Jar file of your program just simply place your sqlite database file near to the created Jar file... After that you will be able to communicate to your database file(can access and modify data) from your application(Jar file)... Thanxxxx...... :)

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.