12. Networking
14. Unit testing

13. exercise: JDBC

  1. Review presentation JDBC


  2. If necessary:
    1. Run sudo leafpad /etc/apt/sources.list and uncomment lines staring with # deb... (delete #)
    2. Run sudo apt-get update to refresh info about repositories
  3. Run sudo apt-get install mysql-server command to install MySQL server
    1. Set password abcd1234 for MySQL's root user
  4. Run sudo apt-get install mysql-workbench to install MySQL workbench
  5. In MySQL execute .../src/main/java/jtm/activity13/database.sql SQL script
  6. Investigate jtm.activity13 package
  7. Implement classes Database and Teacher to pass unit tests

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

12. Networking
14. Unit testing
Izveidojis Valdis Vītoliņš 2017-01-03 10:07
Pēdējais mainījis Valdis Vītoliņš 2017-08-31 18:45
Xwiki Powered
Creative Commons Attribution 3.0 Unported License