Java with SQLite embedded database

preview_player
Показать описание
If your java desktop application needs to store data in a database then a good solution is to embed a database into your solution. This approach avoids the need for the user to install a database separately from the application. This video demonstrates an application which installs the database as part of the application, builds the database tables and populates it with initial data.
Рекомендации по теме
Комментарии
Автор

One of the viewers, @thatnolan, pointed out that the code provided in the video at 24:00 mins has a problem with newer versions of SQLite and he kindly provided a workaround. As an alternative, there is also the option of changing the prepared statement to "insert into user(fname, lname) values(?, ?);" and then calling "prep.setString(1, "John"); prep.setString(2, "McNeil"); prep.execute();". Note the change in the index number when calling the setString method. Hope these two options help.

SoftwarepulseCoUk
Автор

Thank you!
for anyone getting the java.sql.SQLException: Values not bound to statement Exception, its because you didnt put in 3 values. At 24:00 mins he only puts in two values, You need to add prep.setInt(1, any int) to fill in the value. I think this is a thing with the newer SQLite which is why he didn't have the problem in the video.

thatnolan
Автор

This video is very good to understand the global setup but if you are watching this after 2018-19 please be careful has some methods are not appropriate, certain exceptions need to be corrected and you will have to read the documentation to write secure and effective code because certain things shown here are pretty bad practices

edenannonay
Автор

could you import a sql database form localhost xamp to sqlite so that it is only the app with no xamp server, i mean import the sql to sqlite, how is it done

edwinkipruto
Автор

BTW, exists fine Valentina SQLite Server if you suddenly need SQLite for multi-user. Also they have cool Valentina Studio. Great to manage SQLite and other dbs.

dolinigabriel
Автор

Hey. Shouldn't CREATE TABLE IF NOT EXIST do the job instead of checking with the sqlite_master?

tanzwd
Автор

Can i import csv file filled with data instead of declaring the data manually in the program?

zengxi
Автор

Hi, i have problem, how can i protect this sqlitedb file from being deletion?if i deploy java project in locale

gokhancacan
Автор

one thing i don’t understand is how the db knows to auto generate the ID values.

annalisetrite
Автор

I'm getting errors saying the database doesn't exist. I check the workspace, and it does create SQLiteTest.db1, but I can't get anything in the terminal.

Here's what I'm getting in the terminal:

java.sql.SQLException: path to '/home/leo' does not exist

justinstanger
Автор

your case the database size is 2KB but I need to increase the size , ...how can I do

bibhuprasad
Автор

when i was changing instead of john it is not showing can any one help for that

venkateshdhande
Автор

How would you use the addUser() function within the program?

lockNload
Автор

hi, my main problem is that whenever I make the url for the db to be created; it can't be created and i get nothing so, any ideas? regards

IQ
Автор

Any body having Bound errors try "INSERT INTO user(fname, lname) VALUES(?, ?)"

JEBJOSH
Автор

thank you so much, very useful, appreciated !!

TheDagloss
Автор

Quick question: is that windows xp or are you using some sort of theme

definitelynotjess
Автор

Great Video and thanks for the video ^^

abdonajjar
Автор

You should cut the spaces, those 1-2 seconds where you don`t say anything. Great tutorial by the way.

danifeldman
Автор

My question is.

Is there some way to read from a database in a separate folder by giving its location on my computer.
Or does it have to be in the same file location.

I have a database i want to be able to read and modify but that database needs to be in a separate location as it works with a different application

Zalied