TrackMate is a Spring Boot application for inventory management, using an Oracle database to store item details like name and count. It employs Hibernate for seamless CRUD operations and RESTful APIs for adding, updating, and retrieving items. The project is a simple and efficient solution for dynamic item tracking and management tasks.
-
From "https://maven.apache.org/download.cgi" install Binary zip archive
-
Install JAVA JDK
-
Install Oracle from "https://www.oracle.com/middleeast/database/technologies/oracle-database-software-downloads.html#db_free" this one "Oracle Database 21c for Microsoft Windows x64 (64-bit)"
And set the password.
-
Add the path of bin file from "Binary zip archive" to Environmental variables (User variables as well as System variables)
-
In the "sbsite" folder, go to "spring-boot-oracle-integration"
-
In terminal: mvn clean install mvn spring-boot:run
-
Go live with HTML file
[Terminal]
Microsoft Windows [Version 10.0.19045.5247] (c) Microsoft Corporation. All rights reserved. C : \Users SQL*P1us: Release 23.Ø.Ø.Ø.Ø - Production on wed Dec 18 2024 Version 23.6.Ø.24.10 Copyright (c) 1982, 2024, Oracle. All rights reserved. Enter user-name: sqlplus / as sysdba Enter password: Connected to: Oracle Database 23ai Free Release 23.0.ø.ø.ø - Version 23.6.ø.24.10 SQL> SELECT HOST_NAME FROM V$INSTANCE; HOST NME- msi SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE NME- FREE SQL>
In "C:\Users\kname\Desktop\sbsite\spring-boot-oracle-integration\src\main\resources\application.properties" do the changes according to obtained hostname(msi) and service name(FREE)
spring.datasource.url=jdbc:oracle:thin:@:1521:[change this according to the values you get] jdbc:oracle:thin:@hostname:port:sid[stays same] spring.datasource.username=sys[stays same] spring.datasource.password=banana[whatever oracle password you've set] spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
-
Database Table Initialization:
- Inside the Oracle SQL*Plus terminal, create the required table for the application using the schema provided below:
CREATE TABLE ITEM ( ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, NAME VARCHAR2(255) NOT NULL, COUNT NUMBER NOT NULL );
- Grant necessary quotas to avoid errors:
ALTER USER C##SCOTT QUOTA UNLIMITED ON USERS;
- Inside the Oracle SQL*Plus terminal, create the required table for the application using the schema provided below:
-
Test the Database Connection:
- Run the Spring Boot application:
mvn spring-boot:run
- Verify that the application starts successfully and connects to the Oracle database without errors.
- Run the Spring Boot application:
-
Verify Data Insertion:
- Use a REST client like Postman to test the
/api/itemsendpoint:- POST request:
URL:
http://localhost:8080/api/itemsBody:{ "name": "item1", "count": 10 } - Check the Oracle database to ensure the data is inserted using SQL*Plus:
SELECT * FROM ITEM;
- POST request:
URL:
- Use a REST client like Postman to test the
-
HTML Integration:
- To integrate the HTML frontend:
- Serve the static HTML file via a simple HTTP server or IDE live server plugin.
- Ensure the API calls from the frontend point to the Spring Boot application running at
http://localhost:8080.
- To integrate the HTML frontend:
-
Running Locally for Other Users:
- Steps to adapt if a different user sets up the project locally:
- Update
application.propertieswith their Oracle database credentials:hostnameservice nameusernamepassword
- Ensure the necessary software versions (JDK, Maven, Oracle) are compatible with their system.
- Re-run the commands for database setup and table creation.
- Update
- Steps to adapt if a different user sets up the project locally:
-
Debugging Tips:
- If you encounter a quota error, check user quotas:
SELECT USERNAME, TABLESPACE_NAME, BYTES/1024/1024 AS MB FROM DBA_TS_QUOTAS;
- For invalid hostname or service name issues, verify the output of:
SELECT HOST_NAME, INSTANCE_NAME FROM V$INSTANCE;
- Check Spring Boot logs for detailed errors and address any missing configurations or driver issues.
- If you encounter a quota error, check user quotas: