Lucy Snod Lucy Snod - 5 months ago 10
Java Question

How to download and parse an sql file in java

I'm learning java/android development and I have an idea of an app that I want to make.
I want to make an app that displays a list of upcoming games (just an example) that I keep updating frequently. And in order to do that, it downloads a database file (or read it directly without downloading) and parse it to display the information each time the user opens the app.

I searched a lot and I didn't find any way to do it. I'll be thankful if someone tells me how.
I know that it's possible to use a RSS feed but I want to use database if possible.
PS: sorry if my English is terrible.


I would recommend SQL database H2. Simply include the .jar with your project (follow the website installation instructions) and use it in your code with:

Connection con = DriverManager.getConnection("jdbc:h2:"+path_to_database);
con.createStatement().execute("CREATE TABLE games(name VARCHAR(80))");
con.createStatement().execute("INSERT INTO games(name) VALUES('Halo 3')");
// etc...

Their documentation is pretty comprehensive to get you started with reading and writing from the database.