| 123456789101112131415161718192021222324252627282930313233 |
- import java.sql.*;
- /** Sync master ylrz_saas doubao row to match working tenant endpoint/id. */
- public class SyncMasterDoubaoModel {
- public static void main(String[] a) throws Exception {
- Class.forName("com.mysql.cj.jdbc.Driver");
- String tenantJdbc = "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/fs_tenant_cs1"
- + "?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8";
- String masterJdbc = "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/ylrz_saas"
- + "?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8";
- String id = null, key = null, ep = null;
- try (Connection tc = DriverManager.getConnection(tenantJdbc, "root", "Ylrz_1q2w3e4r5t6y");
- Statement ts = tc.createStatement();
- ResultSet rs = ts.executeQuery(
- "SELECT model_identifier, api_key, api_endpoint FROM admin_ai_model WHERE provider_code='doubao' LIMIT 1")) {
- if (rs.next()) {
- id = rs.getString(1);
- key = rs.getString(2);
- ep = rs.getString(3);
- }
- }
- if (id == null) {
- System.out.println("tenant doubao not found");
- return;
- }
- try (Connection mc = DriverManager.getConnection(masterJdbc, "root", "Ylrz_1q2w3e4r5t6y");
- Statement ms = mc.createStatement()) {
- ms.executeUpdate("UPDATE admin_ai_model SET model_identifier='" + id + "', api_key='" + key
- + "', api_endpoint='" + ep + "', update_time=NOW() WHERE provider_code='doubao'");
- System.out.println("master doubao synced id=" + id + " ep=" + ep);
- }
- }
- }
|