mariadb not save result to the table by kotlin

import java.io.File
import java.sql.Connection
import java.sql.DriverManager
import java.sql.PreparedStatement
import java.sql.Statement
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken

data class InputData(val data: List<String>)
data class RegexPatterns(val regex_patterns: Map<String, String>)

fun main() {
    // Load input data from input.json
    val inputFile = File("src/main/resources/input.json")
    val inputData: InputData = Gson().fromJson(inputFile.reader(), InputData::class.java)

    // Load regex patterns from regex.json
    val regexFile = File("src/main/resources/regex.json")
    val regexType = object : TypeToken<RegexPatterns>() {}.type
    val regexPatterns: RegexPatterns = Gson().fromJson(regexFile.reader(), regexType)

    // MariaDB connection details
    val jdbcUrl = "jdbc:mariadb://localhost:3306/sensitive_data"
    val username = "root"
    val password = "your_password"

    // Connect to MariaDB
    val connection: Connection = DriverManager.getConnection(jdbcUrl, username, password)

    // Prepare SQL statement for inserting regex patterns into information_type table
    val insertPatternSQL = "INSERT INTO information_type (name, pattern) VALUES (?, ?)"
    val patternPreparedStatement: PreparedStatement = connection.prepareStatement(insertPatternSQL, Statement.RETURN_GENERATED_KEYS)

    // Insert regex patterns into the information_type table and create corresponding tables for matched values
    val categoryIds = mutableMapOf<String, Int>()
    regexPatterns.regex_patterns.forEach { (category, pattern) ->
        // Insert category and pattern into information_type table
        patternPreparedStatement.setString(1, category)
        patternPreparedStatement.setString(2, pattern)
        patternPreparedStatement.executeUpdate()

        // Get the generated ID for the inserted category
        val generatedKeys = patternPreparedStatement.generatedKeys
        if (generatedKeys.next()) {
            val categoryId = generatedKeys.getInt(1)
            categoryIds[category] = categoryId
            println("Inserted pattern for category: $category with ID: $categoryId")

            // Sanitize the table name
            val tableName = category.replace(" ", "_").replace("'", "").replace("-", "_").replace(",", "").replace("&", "and")
            // Create a new table for the matched values of this category
            val createTableSQL = """
                CREATE TABLE IF NOT EXISTS `$tableName` (
                    ID INT AUTO_INCREMENT PRIMARY KEY,
                    data TEXT
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
            """.trimIndent()
            val statement: Statement = connection.createStatement()
            statement.executeUpdate(createTableSQL)
            println("Created table: $tableName")
        }
    }

    // Prepare SQL statements for inserting matched and non-matched data
    val insertNonMatchedSQL = "INSERT INTO `non-matched` (data) VALUES (?)"
    val nonMatchedPreparedStatement: PreparedStatement = connection.prepareStatement(insertNonMatchedSQL)

    val insertMatchedSQLs = categoryIds.mapValues { (category, _) ->
        val tableName = category.replace(" ", "_").replace("'", "").replace("-", "_").replace(",", "").replace("&", "and")
        connection.prepareStatement("INSERT INTO `$tableName` (data) VALUES (?)")
    }

    // Iterate over each data entry and match with the appropriate pattern
    inputData.data.forEach { entry ->
        var matched = false
        regexPatterns.regex_patterns.forEach { (category, pattern) ->
            val regex = Regex(pattern)
            if (regex.matches(entry)) {
                println(""$category": "$entry"")
                // Insert the matching result into the corresponding table
                insertMatchedSQLs[category]?.setString(1, entry)
                insertMatchedSQLs[category]?.executeUpdate()
                matched = true
                return@forEach
            }
        }
        if (!matched) {
            println("Non-matched data: "$entry"")
            nonMatchedPreparedStatement.setString(1, entry)
            nonMatchedPreparedStatement.executeUpdate()
        }
    }

    // Close the connection
    connection.close()
    println("Data processing complete. Connection closed.")
}

This is my code to match the input with regex pattern. If an input is matched with a pattern, then store that input into the corresponding table with that pattern. If an input is NOT matched with any pattern, then store that input in the non_matched table.
After running this code, it can match correctly but the inputs are NOT stored in the tables. How can I fixed this?
I think there are mistake in these line:
“val insertNonMatchedSQL = “INSERT INTO non-matched (data) VALUES (?)”
“connection.prepareStatement(“INSERT INTO $tableName (data) VALUES (?)”)”
is the VALUES (?) correct?

I would like to store the input data with the corresponding table in the DB

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật