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

Implement a Quarkus extension for the Vert.x DB2 driver #9457

Closed
emmanuelbernard opened this issue May 19, 2020 · 3 comments · Fixed by #9732
Closed

Implement a Quarkus extension for the Vert.x DB2 driver #9457

emmanuelbernard opened this issue May 19, 2020 · 3 comments · Fixed by #9732
Assignees
Milestone

Comments

@emmanuelbernard
Copy link
Member

Hey @aguibert
This is to track that task. I'm adding it to 1.6 as it will have Vert.x 3.9.1

@aguibert
Copy link
Member

Will work on this once #9479 is complete

@rmohta
Copy link

rmohta commented Jul 28, 2020

Hello, Is there any limitation in Reactive DB2 to get current timestamp? The same query works wells in DB2 JDBC driver (See Issue #6293). I have tested it using snapshot jar. Below code, always returns the value of timestamp as null.

And when I connect to our DB2 instance running DB2 v11.1.4.4, then Reactive version will always throw below error - whereas db2-jdbc-driver works fine. What am I doing wrong here?

2020-07-28 01:14:08,771 SEVERE [io.ver.db2.imp.cod.DB2Decoder] (vert.x-eventloop-thread-22) FATAL: Error parsing buffer at index 182 / 0xb6

java.lang.IndexOutOfBoundsException: readerIndex(182) + length(8) exceeds writerIndex(189): PooledSlicedByteBuf(ridx: 182, widx: 189, cap: 189/189, unwrapped: PooledUnsafeDirectByteBuf(ridx: 189, widx: 189, cap: 1024))

Code used for testing

import io.vertx.mutiny.db2client.DB2Pool;
import io.vertx.mutiny.sqlclient.Row;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.Arrays;
import java.util.concurrent.CompletionStage;

@Path("/rx")
public class ReactiveGreetingResource {
    /*
     * Run DB2 Container. When using below, then the Reactive URL is: vertx-reactive:db2://localhost:50000/hreact
     * docker run --rm --publish 50000:50000 --name build-db2 --privileged=true \
            -e DB2INSTANCE=hreact -e DB2INST1_PASSWORD=hreact -e DBNAME=hreact -e LICENSE=accept -e AUTOCONFIG=false -e ARCHIVE_LOGS=false \
            -d  ibmcom/db2:11.5.0.0a
     */


    @Inject
    DB2Pool db2Pool;

    @Path("/hello")
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public CompletionStage<String> hello() {
        return db2Pool.preparedQuery("SELECT\n" +
                "    CURRENT TIMESTAMP \n" +
                "FROM\n" +
                "    sysibm.sysdummy1").execute()
                .map(rows -> {
                    // rows is of type RowSet
                    System.out.printf("Row count: %d, column names: %s.\n",
                            rows.rowCount(),
                            Arrays.toString(rows.columnsNames().toArray(new String[0])));
                    for (Row row : rows) {
                        System.out.printf("helloRx: Will return value as %s.\n", row.getString(0));
                        return row.getString(0);
                    }
                    // should never reach here
                    return "*ERROR*";
                })
                .map(x -> x + " :hello")
                .subscribeAsCompletionStage();
    }

@emmanuelbernard
Copy link
Member Author

@rmohta can you open a new dedicated issue and mention @aguibert ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants