Skip to content

jdbc: BLOB type roundtrip fails #45

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

Closed
ztarvos opened this issue Sep 5, 2018 · 5 comments
Closed

jdbc: BLOB type roundtrip fails #45

ztarvos opened this issue Sep 5, 2018 · 5 comments
Assignees
Labels
bug Something isn't working jdbc
Milestone

Comments

@ztarvos
Copy link

ztarvos commented Sep 5, 2018

Values of BINARY/VARBINARY columns are selected back as strings when initially inserted as byte arrays in a prepared statement.

CREATE TABLE testbin(id INT PRIMARY KEY, b VARBINARY)

PreparedStatement prep = conn.prepareStatement("INSERT INTO testbin(id, b) VALUES (1, ?)");
prep.setBytes(1, new BigInteger("ABCD", 16).toByteArray());
prep.executeUpdate();
...
ResultSet rs = stmt.executeQuery("SELECT b FROM testbin");
rs.next();
rs.getBytes(1) - fails.

Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to [B at org.tarantool.jdbc.SQLResultSet.getBytes(SQLResultSet.java:133) at TestJdbcBinary.main(TestJdbcBinary.java:32)

But when inserted as X’hexstring’ in a basic statement, the value that gets back is byte[].

INSERT INTO testbin(id, b) VALUES(1, X'ABCD') -- OK, select returns byte[]

@kyukhin kyukhin added the bug Something isn't working label Sep 10, 2018
@Totktonada Totktonada added the jdbc label Nov 1, 2018
@Totktonada Totktonada added this to the JDBC MVP milestone Nov 1, 2018
@Totktonada Totktonada changed the title jdbc: BINARY/VARBINARY types roundtrip fails jdbc: BLOB type roundtrip fails Dec 29, 2018
@Totktonada
Copy link
Member

Confirmed on Tarantool 2.1.1-164-gf6a31c034. Commented here: tarantool/tarantool#3650 (comment)

@Totktonada
Copy link
Member

Totktonada commented Jan 25, 2019

The Java connector correclty sends bin8 type in the case, but tarantool stores fixstr and responds with fixint. So this is blocked on tarantool/tarantool#3650

@nicktorwald
Copy link

Nothing has changed after applying the recent Tarantool changes made in scope of tarantool/tarantool#4019 .
The client still receives blob data as a string and a column type as a BLOB instead of SCALAR.

@Totktonada
Copy link
Member

Now it is blocked by the problem described here.

@Totktonada
Copy link
Member

The tarantool side of the issue was resolved in 2.1.1-423-g4007436aa ( tarantool/tarantool@4007436 ). Not blocked now.

@Totktonada Totktonada removed the blocked Not ready to be implemented label Mar 20, 2019
nicktorwald added a commit that referenced this issue Mar 21, 2019
Enable a broken test which was blocked by Tarantool  serverissue related
to SQL BLOB type support.

Closes: #45
See also: tarantool/tarantool#3650, tarantool/tarantool#4019
nicktorwald added a commit that referenced this issue Mar 21, 2019
Enable a broken test which was blocked by Tarantool server issue related
to SQL BLOB type support.

Closes: #45
See also: tarantool/tarantool#3650, tarantool/tarantool#4019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jdbc
Projects
None yet
Development

No branches or pull requests

4 participants