Monday, August 23, 2021

Debian Bullseye: upgrade from Debian Buster XFCE

 

Edit /etc/apt/sources.list

# main security
deb https://security.debian.org/debian-security bullseye-security/updates main
#deb-src https://security.debian.org/debian-security bullseye-security/updates main

# main mirror Indonesia
deb http://kebo.pens.ac.id/debian bullseye main
deb http://kebo.pens.ac.id/debian bullseye-updates main

# NON FREE
deb https://deb.debian.org/debian bullseye main contrib non-free

# BACKPORTS
deb https://deb.debian.org/debian bullseye-backports main

Update without new packages

# apt upgrade --without-new-pkgs

During upgrade, you need to restart some services.

Restart, open root terminal and make full upgrade (required more than 800MB)

# apt full-upgrade

Restart your PC.

Clean up unused installer

# apt-get autoclean && apt-get autoremove -y

If you get trouble connecting to internet (can not resolve servername) after upgrading edit /etc/resolv.conf

search 8.8.8.8 1.1.1.1
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 1.1.1.1

Restart your networking

# systemctl restart networking

If you install dnsmasq and get trouble connecting to internet (can not resolve servername) after upgrading, edit /etc/dnsmasq.conf

#no-resolv
# dedetok 2021-08-18
no-resolv
server=8.8.8.8
server=1.1.1.1

Reboot

Wednesday, August 4, 2021

jdk11: Eclipse MariaDB Connector/J

 

Minimum Java Project JavaSe-1.8.

Adding MariaDB Connector/J 2.7.3 to Eclipse 2021-06:

  1. Download MariaDB Connector/J 2.7.3 (stable) from https://downloads.mariadb.org/connector-java/2.7.3/
  2. Put JAR file in [Workspace] -> [project_name] -> lib (create folder lib)
  3. Right click on Package Explorer -> [project_name] -> Properties
  4. Java Build Path -> Library -> Add External JARs, point it to [Workspace]/[project_name]/lib/mariadb-java-client-2.7.3.jar
  5. Click Apply and Close

Example code to access MariaDB database

package com.dedetok;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class TesCon {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        String muser = "my_user";
        String mpass = "my_password";
        String murl = "jdbc:mariadb://localhost:3306/my_database_name";
        Class.forName("org.mariadb.jdbc.Driver");
        Connection connection = DriverManager.getConnection(murl, muser, mpass);
        System.out.println("ok");
    }
}