783407b96727a5527d26efae2501ee6547493ce9
angie
  Mon Apr 6 16:19:25 2015 -0700
Better to use hTableExists() as Max pointed out.  refs #15126

diff --git src/hg/lib/hAnno.c src/hg/lib/hAnno.c
index e6512d5..423f0df 100644
--- src/hg/lib/hAnno.c
+++ src/hg/lib/hAnno.c
@@ -284,34 +284,32 @@
     warn("Sorry, %s is not yet supported", tdb->type);
 else if (startsWithWord("bed", tdb->type) && !strchr(tdb->type, '+'))
     {
     // BED with no + fields; parse bed field count out of type line.
     int bedFieldCount = 3;
     char typeCopy[PATH_LEN];
     safecpy(typeCopy, sizeof(typeCopy), tdb->type);
     char *words[8];
     int wordCount = chopLine(typeCopy, words);
     if (wordCount > 1)
         bedFieldCount = atoi(words[1]);
     asObj = asParseText(bedAsDef(bedFieldCount, bedFieldCount));
     }
 else if (sameString(tdb->track, "knownGene"))
     {
-    struct sqlConnection *conn = hAllocConn(db);
-    if (sqlTableExists(conn, "knownGene") && sqlTableExists(conn, "kgXref"))
+    if (hTableExists(db, "knownGene") && hTableExists(db, "kgXref"))
         asObj = annoStreamDbKnownGeneAsObj();
-    hFreeConn(&conn);
     }
 return asObj;
 }
 
 struct asObject *hAnnoGetAutoSqlForTdb(char *db, char *chrom, struct trackDb *tdb)
 /* If possible, return the asObj that a streamer for this track would use, otherwise NULL. */
 {
 struct asObject *asObj = getAutoSqlForType(db, chrom, tdb);
 
 if (!asObj && !isHubTrack(tdb->track))
     {
     // If none of the above, it must be a database table; deduce autoSql from sql fields.
     char *dataDb = db, *dbTable = tdb->table;
     if (isCustomTrack(tdb->track))
         {