vertx-jdbc-client icon indicating copy to clipboard operation
vertx-jdbc-client copied to clipboard

Result Set for CLOB TYPE with non ASCII character

Open hungnt1997 opened this issue 3 years ago • 7 comments

Version

This bug is in the tree since 4.2.1, 4.1.1 seems ok.

Context

I just upgrade the JDBC version from 4.1.1 to 4.2.1 I saw that JDBC 4.2.1 client has using getAsciiStream to read data from oracle with CLOB type, with is getting an error with NON-ASCII character.

Do you have a reproducer?

  1. Save non-ASCII to Oracle with UTF-8 encoding and CLOB type.
  2. Get data from oracle with JDBC version 4.2.1.
  3. Getting the result with the difference from the database.

hungnt1997 avatar Nov 30 '21 13:11 hungnt1997

Hello! I have the same problem. In versión 4.1.8 works fine. If I update to version 4.2.X or higher it already fails. Incorrect characters appear than with the previous version. It also happens in the latest version 4.5.8.

Can you fix this please? It prevents me from updating the dependencies of my project... @jponge

Thanks!

JGrancha avatar May 31 '24 11:05 JGrancha

Can you paste snippets for Oracle table creation and Vert.x JDBC Client code? So that we can easily reproduce. Thanks

tsegismont avatar May 31 '24 16:05 tsegismont

Hello, this is the helper to execute querys. `import io.vertx.core.Vertx import io.vertx.core.json.JsonArray import io.vertx.core.json.JsonObject import io.vertx.jdbcclient.JDBCConnectOptions import io.vertx.jdbcclient.JDBCPool import io.vertx.kotlin.coroutines.await import io.vertx.sqlclient.PoolOptions import io.vertx.sqlclient.Tuple import org.slf4j.LoggerFactory

class JDBCHelper { companion object { private val LOG = LoggerFactory.getLogger(JDBCHelper::class.java) private lateinit var pool: JDBCPool

fun init(vertx: Vertx, conf: JsonObject) {
  pool = JDBCPool.pool(
    vertx,
    JDBCConnectOptions()
      .setUser(conf.getString("user"))
      .setPassword(conf.getString("password"))
      .setJdbcUrl(
        String.format(
          "jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = %s)(PORT = %s))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = %s)))",
          conf.getString("host"),
          conf.getInteger("port"),
          conf.getString("sid")
        )
      )
    ,PoolOptions().setMaxSize(20)
  )
  LOG.info("Creando cliente JDBC")
}

suspend fun execPreparedQuery(queryStr: String, params: JsonArray): List<JsonObject> {
  val conn = pool.connection.await()
  val result = conn.preparedQuery(queryStr).execute(Tuple.from(params.list)).await()
  conn.close().await()
  return result.map { row -> row.toJson()  }
}

suspend fun execQuery(queryStr: String): List<JsonObject> {
  val conn = pool.connection.await()
  val result = conn.query(queryStr).execute().await()
  conn.close().await()
  return result.map { row -> row.toJson()  }
}

} } `

And the creation of the table:

CREATE TABLE LANDING_TEMPLATES ( LDT_ID NUMBER (10,0) NOT NULL, LDT_HTML CLOB, LDT_CSS CLOB, )

With version 4.1.8: image

With last version 4.5.8: image

Note: With the versions > 4.1.8 appears the problem.

JGrancha avatar May 31 '24 17:05 JGrancha

Hi @tsegismont! Any news?

Thanks!

JGrancha avatar Jun 04 '24 20:06 JGrancha

Not yet

tsegismont avatar Jun 17 '24 09:06 tsegismont

Hello!

Do you have an estimate of when this will be resolved?

JGrancha avatar Sep 09 '24 08:09 JGrancha

Sorry, no

tsegismont avatar Sep 12 '24 16:09 tsegismont