package com.ffii.core.test;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class test {
    private static final String JDBC_DRIVER = "your_jdbc_driver"; // Replace with your actual driver
    private static final String DB_URL = "jdbc:mysql://127.0.0.1:3308/pet_app?useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8"; // Replace with your connection details
    private static final String USER = "root"; // Replace with your database username
    private static final String PASSWORD = "secret"; // Replace with your database password

    public static List<String> getDatabaseNames() {
        List<String> databaseNames = new ArrayList<>();
        try (Connection connection = DriverManager.getConnection(DB_URL, USER, PASSWORD)) {
          DatabaseMetaData metaData = connection.getMetaData();
          ResultSet rs = metaData.getCatalogs();
          while (rs.next()) {
            databaseNames.add(rs.getString(1));
          }
        } catch (SQLException e) {
          e.printStackTrace();
         
        }
        return databaseNames;
      }
}
