If it is not explicitly told in following recipe, setting up services are described for Ubuntu 20.04 server, but applications are described for Xubuntu 20.04 workstation. If you use different Ubuntu version or Linux distribution, settings as well as content, names and places of configuration files may be different!
Got it.

13. JDBC

General steps

Review topic

  1. Review presentation JDBC

    Practical exercise

Set up database

  1. If necessary, change values of user, password and database variables in TeacherManager.java class and  key values of src/resources/appplication.properties configuration file
  2. Create new database user, by executing following commands in terminal (each line one by one!):

    mysql -ustudent -pStudent007
    CREATE USER 'uXX'@'localhost' IDENTIFIED BY 'uXX';

    where XX is your given number.

  3. Create structure of the database, by executing following commands in terminal:

    cd ~/workspace/uXX/src/main/java/jtm/activity13/
    mysql -ustudent -pStudent007
    create database databaseXX;
    GRANT ALL ON databaseXX.* TO 'uXX'@'localhost';
    mysql -uuXX -puXX databaseXX < database.sql

    where XX is your given number.

Implement activity

  1. Investigate jtm.activity13 package
  2. Implement class TeacherManager to pass unit tests

Extra exercise

Error solution

  1. To check that server is running:

    ss -ntlp|grep 3306

    should return:

    LISTEN    0         151       *
    LISTEN    0         70       *
  2. Check, that you can log into server, run MySQL console:

    mysql -uuXX -puXX

    Then, inside MySQL console:

    show databases;

    should return list of databases.


Extra exercises

Additional info

In English

In Latvian


Created by Valdis Vītoliņš on 2020-05-28 10:56
Last modified by Valdis Vītoliņš on 2021-05-22 17:59
Xwiki Powered
Creative Commons Attribution 3.0 Unported License