Basic CRUD Java library system example using Java Swing and MySql
Author: LTprograms
To start using this app, you should first have installed java on your computer, you
can install the JDK and JRE using these links:
JDK: https://www.oracle.com/pe/java/technologies/downloads/
JRE: https://www.java.com/es/download/ie_manual.jsp
JDK 20 and JRE 8 were used to build this app, in case you have any version problem try to download these software versions or instead try to update the version in configuration files
This app was built using NetBeans IDE 18, but you can use any other program. Keep in mind some configuration files might cause some issues. However, you can download NetBeans using this link:
NetBeans IDE: https://netbeans.apache.org/
It was used MySQL as the DBMS (Data Base Managment System), but you can use any other if you want, but remember that every DBMS has its own driver to work with java, so be sure you download the correct driver in the next step. In this case, I used XAMPP 8.0.28, but there is no problem if you download any other version.
XAMPP: https://www.apachefriends.org/download.html
As I mentioned before, you must install the JDBC driver to work with databases, and each DBMS has its own JDBC version, so be sure you install the correct driver if you are using any other DBMS. If you're following me, you can install MySQL JDBC driver in this link, I'm using 5.1.49 version:
JDBC: https://downloads.mysql.com/archives/get/p/3/file/mysql-connector-java-5.1.49.zip
Once you have installed it, you should include the .jar file in Libraries folder as in the image:
That's all installation you have to do, if you arrive to this point, congratulations, you can keep reading the documentation if you want. In case you had problems in the previous steps, you can contact me or follow any tutorial on YouTube. Good Luck!
In the main folder, you will find 'library.sql' file, you can execute it in your DBMS or export it using the export function and selecting this file.
I'm using MVC (Model View Controller) architecture, so you will find 3 packages in src folder
Here are two classes, Book and JConnection, they are the entities used in this small project
- Book: Class with some attributes such as name(String), author(String), stock(int), category(String), etc. It has its Constructors and getters/setters
- JConnection: Class to create the connection between the database and the java app. It has some attributes such as user and password, which are the credentials to link the DDBB with our program, in case you have other credentials, just change the variable values to your own ones
It has just one JFrame class to build the GUI (Graphical User Interface), you can adjust the design up to you, or add some other buttons or functionalities.
It's got only one class named Controller, that links the view with the models and set buttons functionalities
This is the main class, in case you had any doubts, you can contact me, I left some comments in the code anyway.


