hortonworks-spark / spark-llap

Apache License 2.0
101 stars 68 forks source link

Fix rising exceptions in DefaultJDBCWrapper #259

Closed dmitrybugakov closed 4 years ago

dmitrybugakov commented 5 years ago

Hi there. Can you catch exceptions in executeUpdate, please.

  def executeUpdate(conn: Connection,
                  currentDatabase: String,
                  query: String): Boolean = {
    useDatabase(conn, currentDatabase)
    val stmt = conn.prepareStatement(query)
    log.debug(query)
    //TODO Workaround until HIVE-14388 provides stmt.numRowsAffected
    try {
      stmt.execute()
      true
    } catch {
      case e: Exception =>
        log.error(s"executeUpdate failed for query: ${query}", e)
        false
    } finally {
      stmt.close()
    }
  }