Monday, December 8, 2025

.::: Simulation create view with additional ID Unique row_number(),hash /md5 & Primary Key :::.

 


1. Buat Tabel dengan tanggal_lahir
CREATE TABLE karyawan (
    emp_id INT AUTO_INCREMENT PRIMARY KEY,
    nama VARCHAR(100),
    jabatan VARCHAR(100),
    lokasi VARCHAR(100),
    tanggal_lahir DATE
);
 

.::: Troubleshoot MariaDB Incorrect number of arguments for PROCEDURE teguhth.spbuy; expected 15, got 14 :::.

 

Dari gambar error tersebut terlihat jelas penyebabnya:

Incorrect number of arguments for FUNCTION ... expected 15, got 14

Artinya: FUNCTION atau Stored Procedure spbuy (atau sptaxsample) membutuhkan 15 parameter, tapi saat dipanggil hanya diberikan 14 parameter.

. Tujuan Anda

Anda ingin mensimulasikan kasus tersebut pada database sample MariaDB dengan database contoh bernama hris.

Saya buatkan contoh struktur database, fungsi, dan pemanggilan yang benar & salah, sehingga error yang sama bisa direplikasi.

. SIMULASI DI MARIADB: Database hris

1. Buat Database Sample
CREATE DATABASE IF NOT EXISTS hris;
USE hris;
 

Friday, December 5, 2025

.::: T-SQL Script to Drop All Tables: Foreign-Key Tables First, Then Other Tables, While Excluding One Table (e.g., barang) :::.

 

Berikut beberapa pilihan query SQL Server untuk menampilkan daftar tabel yang memiliki Foreign Key dan diurutkan.

1. Urut berdasarkan nama tabel
SELECT DISTINCT 
    t.name AS TableName
FROM 
    sys.foreign_keys fk
INNER JOIN 
    sys.tables t ON fk.parent_object_id = t.object_id
ORDER BY 
    t.name;

 

.::: Backup & restore table SQL Server Using bcp & SQL CMD like MariaDB :::.

 


A. Source (backup data )

1. check table barang 
  


2. Backup data as table using bcp 

bcp teguhth.dbo.barang out "C:\Backup\barang.txt" -c -t, -S localhost -U usertest -P passwordsql

bcp barang out "C:\Backup\barang.txt" -c -t, -S localhost -U usertest -P passwordsql -d teguhth

 

Tuesday, December 2, 2025

.::: Drop All tables in database using Truncate & drop :::.


correlation with https://teguhth.blogspot.com/2025/10/script-drop-all-database-non-system-in.html

1. Drop table using script
 
 

2. Drop table using script and duration
 


3. script drop_table_indb.sh


[root@teguhth tbldrop]# pwd
/data/drop/tbldrop
[root@teguhth tbldrop]# cat drop_table_indb.sh
#!/bin/bash
# ===========================================================
# Script Name  : drop_all_tbl_confirm.sh
# Tujuan       : Menghapus semua tables dari 1 Database MariaDB dengan konfirmasi
# OS Diuji     : CentOS 9
# Author       : Teguh Triharto
# ===========================================================

# === Konfigurasi koneksi ===
USER="admin"
PASS="admin"
HOST="localhost"
DBX="secretdb"
PORT="3306"

Friday, November 28, 2025

.::: Simulation API PATCH Curl Using Phyton & MariaDB MySQL with HTTP Status Code 500, 400, 200, 404 :::.

 

continue from https://teguhth.blogspot.com/2025/11/simulation-api-post-using-phyton.html

1. script get sample

[root@teguhth api]# cat patch_api_buy.py
from flask import Flask, request, jsonify
import mysql.connector

app = Flask(__name__)

def get_db():
    return mysql.connector.connect(
        host="localhost",
        user="admin",
        password="admin",
        database="hris"
    )

.::: Simulation API PUT Curl Using Phyton & MariaDB MySQL with HTTP Status Code 500, 400, 200, 404 :::.

 


continue from https://teguhth.blogspot.com/2025/11/simulation-api-post-using-phyton.html

1. script get sample

[root@teguhth api]# cat /data/api/put_api_buy.py
from flask import Flask, request, jsonify
import mysql.connector

app = Flask(__name__)

def get_db():
    return mysql.connector.connect(
        host="localhost",
        user="admin",
        password="admin",
        database="hris"
    )

Thursday, November 27, 2025

.::: Simulation API GET Curl Using Phyton & MariaDB MySQL with HTTP Status Code 500, 400, 200, 404 :::.

 

continue from https://teguhth.blogspot.com/2025/11/simulation-api-post-using-phyton.html

1. script get sample

[root@teguhth api]# cat /data/api/get_api_buy.py
from flask import Flask, request, jsonify
import mysql.connector

app = Flask(__name__)

def get_db():
    return mysql.connector.connect(
        host="localhost",
        user="admin",
        password="admin",
        database="hris"
    )

@app.route('/get-buy-period', methods=['GET'])
def get_buy_period():
    # Ambil data dari query string
    year = request.args.get("year")
    month = request.args.get("month")
 

.::: Simulation API POST Using Phyton & MariaDB MySQL with HTTP Status Code 500, 422, 200, 405 :::.

 


1. Install phyton

sudo dnf install python3 python3-pip -y
pip3 install flask mysql-connector-python


2. create database sample & insert data  

CREATE DATABASE hris;
USE hris;

CREATE TABLE buy_period (
    id INT AUTO_INCREMENT PRIMARY KEY,
    period_year INT NOT NULL,
    period_month INT NOT NULL,
    start_date DATE NOT NULL,
    end_date DATE NOT NULL
);

 

Tuesday, November 25, 2025

.::: Install Lucee 6 In Almalinux 9 Centos 9 :::.

 



1. Install httpd & enable 

dnf install httpd -y

systemctl enable httpd
systemctl start httpd


2. download lucee wget https://cdn.lucee.org/lucee-6.2.3.35-linux-x64-installer.run

3. install lucee 


/opt/lucee-6.2.3.35-linux-x64-installer.run

[root@teguhth nitip2]# /opt/lucee-6.2.3.35-linux-x64-installer.run
----------------------------------------------------------------------------
Welcome to the Lucee Installer.

Tomcat Version: 11.0.13
Bundled Java: 21.0.9+10-LTS

----------------------------------------------------------------------------
Please read the following License Agreement. You must accept the terms of this
agreement before continuing with the installation.
 

Monday, November 24, 2025

.::: Testing Script Lucee using Driver MariaDB & MySQL to access MariaDB Database :::.

 

1. create database & access

CREATE DATABASE testdb;
CREATE USER 'luceeuser'@'%' IDENTIFIED BY 'Password123!';
GRANT ALL PRIVILEGES ON testdb.* TO 'luceeuser'@'%';
FLUSH PRIVILEGES;

CREATE TABLE IF NOT EXISTS test_table (
            id INT AUTO_INCREMENT PRIMARY KEY,
            pesan VARCHAR(255)
        );

INSERT INTO test_table (pesan) VALUES ('Halo dari Lucee di CentOS 9!');

SELECT * FROM test_table ORDER BY id DESC LIMIT 5;

 

Popular Posts