Skip to content

Automating database connection

Description

Adds the database connection as a service to be used by endpoints

Issue

Issue 55

Feature

Connect to database and execute query

Tophatting

Just run the application and enter the database url, user and password URL: jdbc:mysql://localhost:3306/whatoodo USERNAME: root PASSWORD: Your own

Expected current behavior

Screenshot_2022-11-11_at_3.56.48_PM

Changes

  • Added a function to retrieve user input for database connection
  • Added a function to connect to database
  • Added a function to fetch query

Screenshots

Screenshot_2022-11-11_at_3.56.48_PM

Design Patterns

Service design

Deviations

Were there any deviations from the original design or architecture plan. If yes, what were they ?

No deviations!!

Additional

  • Unit test written
  • Meets requirements
  • Cross-browser tested
  • Added/updated documentation as needed
  • Camel case style used

DATABASE SCRIPT

show databases;
create database whatoodo;
use whatoodo;

create table USER_INFORMATION(
	USERID long,
    USERNAME varchar(255),
    EMAIL varchar(255),
    PASSWORD varchar(255),
    FIRSTNAME varchar(255),
    LASTNAME varchar(255),
    OCCUPATION varchar(255)
    );
    
    show tables;
    
    INSERT INTO USER_INFORMATION(USERID, USERNAME, EMAIL, PASSWORD, FIRSTNAME, LASTNAME, OCCUPATION)
    VALUES (1, 'maryam', 'maryam@gmail.com', 'maryam', 'Maryam', 'Afshar', 'Student');
    
    select * from USER_INFORMATION;

Closes #55 (closed)

Merge request reports