45014fb713fc38c6fa2c5ca8e76874c5b48d133d
hiram
  Wed May 27 16:05:11 2026 -0700
correctly use the appropriate host for the hgcentral table refs #31811

diff --git src/hg/hubApi/apiUtils.c src/hg/hubApi/apiUtils.c
index b1a367a48df..bed46b6782e 100644
--- src/hg/hubApi/apiUtils.c
+++ src/hg/hubApi/apiUtils.c
@@ -807,15 +807,37 @@
         safef(outString, sizeof(outString), "# downloadTimeStamp: %lld",
             (long long) timeNow);
         dyStringPrintf(textOutput, "%s\n", outString);
         }
     }
 
 dyStringPrintf(textOutput, "%s\n", lineOut);
 }
 
 void textFinishOutput()
 /* all done with text output, print it all out */
 {
 puts("Content-Type:text/plain\n");
 printf("%s", dyStringCannibalize(&textOutput));
 }
+
+struct sqlConnection *hConnectOtto()
+/* Connect to otto database using otto profile, fallback to central */
+{
+char *ottoDb = cfgOption2("otto", "db");
+if (isEmpty(ottoDb))
+    {
+    // No otto profile defined, use central
+    return hConnectCentral();
+    }
+
+struct sqlConnection *conn = sqlConnectProfile("otto", ottoDb);
+if (conn == NULL)
+    errAbort("Cannot connect to otto database '%s' using otto profile", ottoDb);
+return conn;
+}
+
+void hDisconnectOtto(struct sqlConnection **pConn)
+/* Disconnect otto connection */
+{
+sqlDisconnect(pConn);
+}