Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batch execution involving BLOB not working for oracle #259

Open
klas3000 opened this issue Dec 30, 2021 · 0 comments
Open

batch execution involving BLOB not working for oracle #259

klas3000 opened this issue Dec 30, 2021 · 0 comments
Assignees
Labels
Milestone

Comments

@klas3000
Copy link

Version

4.2.3

Context

given table

CREATE TABLE my_table
(
  ID        NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  author    varchar2(20),
  book      BLOB
);

I try to INSERT using "executeBatch"

    fun demo(useBatch : Boolean) {
        val sql = "INSERT INTO my_table (author, book) VALUES (?, ?) "
        val tuple = Tuple.of("john", JsonObject().put("page1", "once upon a time...").toBuffer())
        if (useBatch)
            jdbcPool.preparedQuery(sql).executeBatch(listOf(tuple)).onSuccess {
                println("batch ok")
            }.onFailure {
                it.printStackTrace()
                println("batch failed")
            }
        else
            jdbcPool.preparedQuery(sql).execute(tuple).onSuccess {
                println("plain ok")
            }.onFailure {
                it.printStackTrace()
                println("plain failed")
            }
    }

Steps to reproduce

for reference, plain, non-batch path: "always works".

but not "executeBatch".

first exception encountered:

java.sql.SQLException: Invalid argument(s) in call: putBytes()
	at oracle.jdbc.driver.T4CConnection.putBytes(T4CConnection.java:3617)
	at oracle.jdbc.driver.OracleBlob.setBytes(OracleBlob.java:717)
	at oracle.sql.BLOB.setBytes(BLOB.java:778)
	at io.vertx.jdbcclient.impl.actions.JDBCPreparedBatch.adaptType(JDBCPreparedBatch.java:130)
	at io.vertx.jdbcclient.impl.actions.JDBCPreparedBatch.fillStatement(JDBCPreparedBatch.java:102)
	at io.vertx.jdbcclient.impl.actions.JDBCPreparedBatch.execute(JDBCPreparedBatch.java:55)
	at io.vertx.jdbcclient.impl.actions.JDBCPreparedBatch.execute(JDBCPreparedBatch.java:38)	

seems to be an "off by one" error here
https://github.com/vert-x3/vertx-jdbc-client/blob/4.2.3/src/main/java/io/vertx/jdbcclient/impl/actions/JDBCPreparedBatch.java#L130
( should be setBytes(1, ...) )

tried to patch that one locally...
unfortunately, it did not end there.
2nd exception:

java.sql.BatchUpdateException: ORA-00932: inconsistent datatypes: expected BLOB got NUMBER
	at oracle.jdbc.driver.OraclePreparedStatement.executeLargeBatch(OraclePreparedStatement.java:9711)
	at oracle.jdbc.driver.T4CPreparedStatement.executeLargeBatch(T4CPreparedStatement.java:1447)
	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9487)
	at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:237)
	at oracle.ucp.jdbc.proxy.oracle$1ucp$1jdbc$1proxy$1oracle$1StatementProxy$2oracle$1jdbc$1internal$1OraclePreparedStatement$$$Proxy.executeBatch(Unknown Source)
	at io.vertx.jdbcclient.impl.actions.JDBCPreparedBatch.execute(JDBCPreparedBatch.java:58)
	at io.vertx.jdbcclient.impl.actions.JDBCPreparedBatch.execute(JDBCPreparedBatch.java:38)
	at io.vertx.ext.jdbc.impl.JDBCConnectionImpl.lambda$schedule$3(JDBCConnectionImpl.java:219)

Extra

currently on oracle driver 19.10.0.0.0.
using pre-existing datasource/ucp-pool.
wired into vertx using JDBCPool.pool(vertx, datasource)

( see also thread https://groups.google.com/g/vertx/c/z3a8JCVQT5Y/m/oAnS4ttIAgAJ )

@klas3000 klas3000 added the bug label Dec 30, 2021
@vietj vietj added this to the 4.2.4 milestone Jan 3, 2022
@vietj vietj modified the milestones: 4.2.5, 4.2.6 Feb 16, 2022
@vietj vietj modified the milestones: 4.2.6, 4.2.7 Mar 17, 2022
@vietj vietj modified the milestones: 4.3.1, 4.3.2 May 25, 2022
@vietj vietj modified the milestones: 4.3.3, 4.3.4 Aug 9, 2022
@vietj vietj modified the milestones: 4.3.4, 4.3.5 Oct 1, 2022
@vietj vietj modified the milestones: 4.3.5, 4.4.0 Nov 18, 2022
@vietj vietj modified the milestones: 4.4.0, 4.4.1 Mar 2, 2023
@vietj vietj modified the milestones: 4.4.1, 4.4.2 Mar 31, 2023
@vietj vietj modified the milestones: 4.4.2, 4.4.3 May 12, 2023
@vietj vietj modified the milestones: 4.4.3, 4.4.4-SNAPSHOT, 4.4.4 Jun 7, 2023
@vietj vietj modified the milestones: 4.4.4, 4.4.5 Jun 22, 2023
@vietj vietj modified the milestones: 4.4.5, 4.4.6 Aug 30, 2023
@vietj vietj removed this from the 4.4.6 milestone Sep 12, 2023
@vietj vietj added this to the 4.5.0 milestone Sep 12, 2023
@vietj vietj modified the milestones: 4.5.0, 4.5.1 Nov 15, 2023
@vietj vietj modified the milestones: 4.5.1, 4.5.2 Dec 13, 2023
@vietj vietj modified the milestones: 4.5.2, 4.5.3 Jan 30, 2024
@vietj vietj modified the milestones: 4.5.3, 4.5.4 Feb 6, 2024
@vietj vietj modified the milestones: 4.5.4, 4.5.5 Feb 22, 2024
@vietj vietj modified the milestones: 4.5.5, 4.5.6 Mar 14, 2024
@vietj vietj modified the milestones: 4.5.6, 4.5.7, 4.5.8 Mar 21, 2024
@vietj vietj modified the milestones: 4.5.8, 4.5.9 May 24, 2024
@vietj vietj modified the milestones: 4.5.9, 4.5.10 Jul 17, 2024
@vietj vietj modified the milestones: 4.5.10, 4.5.11 Sep 4, 2024
@vietj vietj modified the milestones: 4.5.11, 4.5.12 Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants