Prev
12. Networking
Next
14. Unit testing

13. exercise: JDBC

  1. Review presentation JDBC

      

Set up MySQL and database

  1. If necessary:
    1. Run sudo leafpad /etc/apt/sources.list and uncomment lines staring with # deb... (delete #)

      Do not uncomment # deb cdrom..., because then manager will look for installation disk!
    2. Run sudo apt-get update to refresh info about repositories
  2. Run sudo apt-get install mysql-server command to install MySQL server
    1. Set password Student007 for MySQL's root user
  3. Run sudo apt-get install mysql-workbench to install MySQL workbench
  4. In MySQL Workbenche open and execute .../src/main/java/jtm/activity13/database.sql SQL script

Implement activity

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

Configure detailed MySQL logging

To enable detailed logging on MySQL server:

  1. Open configuration file:

    sudo leafpad /etc/mysql/mysql.conf.d/mysqld.cnf
  2. Change two lines to following (i.e. remove from beginning of line):

    general_log_file        = /var/log/mysql/mysql.log
    general_log             = 1
  3. Restart mysql server:

    sudo systemctl restart mysql
  4. To watch log in real time, run command:

    sudo tail -f /var/log/mysql/mysql.log

Extra exercise

More info

In English

In Latvian

Prev
12. Networking
Next
14. Unit testing
Tags:
Created by Valdis Vītoliņš on 2017-01-03 10:07
Last modified by Valdis Vītoliņš on 2019-03-29 10:37
 
Xwiki Powered
Creative Commons Attribution 3.0 Unported License