How to store data in SqlLite database (JavaFX on Android)

704 views Asked by At

I created a small application in JavaFX and deployed it in my Android device using Gluon Plugin. One of the requirements of my application is to store data in SqlLite database. I know how to do it using Android SDK but I dont have any idea on how to do it in JavaFX. Need help!

1

There are 1 answers

0
ItachiUchiha On BEST ANSWER

Download and add the SQLite JDBC to your classpath.

Following it, create a connection :

Class.forName("org.sqlite.JDBC");  
connection = DriverManager.getConnection("jdbc:sqlite:somefilename.db");

You can replace somefilename.db with somefilelocation\somefilename.db, if you want to specify the location of the database file.

Then use the connection to create Statements and ResultSets to interact with the database. Everything is mentioned in the tutorial, @MadProgrammer just gave you.