Skip to content

jdbc: NPE when trying to execute update #39

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 · 10 comments
Closed

jdbc: NPE when trying to execute update #39

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

Comments

@ztarvos
Copy link

ztarvos commented Sep 5, 2018

Driver throws null pointer exception when trying to execute update (either DML or DDL).

Statement stmt = conn.createStatement();
int count = stmt.executeUpdate("CREATE TABLE test(id INT PRIMARY KEY, val VARCHAR(20))");

Exception in thread "main" java.lang.NullPointerException at org.tarantool.JDBCBridge.update(JDBCBridge.java:38) at org.tarantool.jdbc.SQLStatement.executeUpdate(SQLStatement.java:35) at TestJdbcUpdate.main(TestJdbcUpdate.java:18)

Probably the constants related to IPROTO in the driver are somewhat obsolete.

@Khatskevich
Copy link

The problem is simpler.
It is fixed in brunch https://github.com/tarantool/tarantool-java/tree/kh/fix_dml

Khatskevich added a commit that referenced this issue Sep 5, 2018
Tarantol connector do not send any `metadata` and `rows` in case
of SQL ddl and dml.

Before this patch absence of those attributes lead to a
NullPointerException.

Closes #39
Khatskevich added a commit that referenced this issue Sep 6, 2018
Tarantol connector do not send any `metadata` and `rows` in case
of SQL ddl and dml.

Before this patch absence of those attributes lead to a
NullPointerException.

Closes #39
@ztarvos
Copy link
Author

ztarvos commented Sep 6, 2018

Hi!
Actually, I do not see how these changes fix the issue. Probably a test would help.
My own test finally worked when I changed the two constants in Key.java to be in sync with the fresh tarantool 2.0 branch, namely SQL_INFO(0x42) and SQL_ROW_COUNT(0). It even did return correct row count back.

@Khatskevich
Copy link

Great! Patches are welcome)

P.S. I did not investigate the issue deeply. My patch just let me run my own tests.

@ztarvos
Copy link
Author

ztarvos commented Sep 6, 2018

Sure, I will prepare a patch.
Thanks!

@kyukhin kyukhin added the bug Something isn't working label Sep 10, 2018
ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Sep 12, 2018
Updated constants be in sync with tarantool IPROTO.
Added tests for the working JDBC functionality.

Closes tarantool#39
@Totktonada
Copy link
Member

@ztarvos Any updates? I see you created the patch. Are you going to open the pull request?

It seems the constants was changed on tarantool side? So, we'll break compatibility with older version if will update them here. What version of tarantool changes it?

@ztarvos
Copy link
Author

ztarvos commented Sep 17, 2018

Hi!

@ztarvos Any updates? I see you created the patch. Are you going to open the pull request?

I was hoping to see the test infrastructure merged to the jdbc branch first (PR#50) so I can base my changes on it. My fix contains integration tests which require a tarantool instance running. It will not work without it.

It seems the constants was changed on tarantool side? So, we'll break compatibility with older version if will update them here. What version of tarantool changes it?

These constants are related to SQL and only present on the connector-1.8jdbc branch of tarantool-java, so I guess nothing is broken. For tarantool itself, I think they appeared in 2.0.

@Totktonada
Copy link
Member

Merged initial test infrastructure with #50.

ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Sep 17, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes tarantool#39
ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Sep 17, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes tarantool#39
@ztarvos
Copy link
Author

ztarvos commented Sep 17, 2018

@Totktonada Thanks! I rebased my fix and am ready to submit it.
@kyukhin Should I create a PR or send a patch via mail?

@Totktonada
Copy link
Member

@ztarvos Feel free to use PRs or the mailing list as you wish. I don't think we should enforce community to follow tarantool engineers' policy. Please, let me in To or CC when a review from me is needed.

To be honest I think that PRs are better for small projects (at least), because allows to catch all related discussions within the one place and don't fragment it across issues and a mailing list. GitHub works great with interlinking anything with anything related :)

ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Sep 18, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes tarantool#39
Totktonada pushed a commit that referenced this issue Sep 18, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes #39
@kyukhin
Copy link

kyukhin commented Sep 20, 2018

Fixed by 8aad007

@kyukhin kyukhin closed this as completed Sep 20, 2018
@Totktonada Totktonada added the jdbc label Nov 1, 2018
@Totktonada Totktonada added this to the JDBC MVP milestone Nov 1, 2018
Totktonada pushed a commit that referenced this issue Dec 11, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes #39
Totktonada pushed a commit that referenced this issue Dec 11, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes #39

----

Rebase fixes (Alexander Turenko):

* Perform cleanup of the test directory once before all tests (move it
  from the TarantoolControl constructor).
* Added starting of jdk-testing instance using TarantoolControl to JDBC
  tests.
* Wait for the instance to be started in setupEnv().
Totktonada pushed a commit that referenced this issue Dec 11, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes #39

----

Rebase fixes (Alexander Turenko):

* Perform cleanup of the test directory once before all tests (move it
  from the TarantoolControl constructor).
* Added starting of jdk-testing instance using TarantoolControl to JDBC
  tests.
* Wait for the instance to be started / stopped in setupEnv() /
  cleanupEnv().
Totktonada pushed a commit that referenced this issue Dec 12, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes #39

----

Rebase fixes (Alexander Turenko):

* Perform cleanup of the test directory once before all tests (move it
  from the TarantoolControl constructor).
* Added starting of jdk-testing instance using TarantoolControl to JDBC
  tests.
* Wait for the instance to be started / stopped in setupEnv() /
  cleanupEnv().
Totktonada pushed a commit that referenced this issue Dec 12, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes #39

----

Rebase fixes (Alexander Turenko):

* Perform cleanup of the test directory once before all tests (move it
  from the TarantoolControl constructor).
* Start tarantool from the Java code in JDBC tests (use
  TarantoolControl).
* Wait for the instance to be started / stopped in setupEnv() /
  cleanupEnv(); add waiting into startTarantool() / stopTarantool() also
  should fix races in testLongParallelCloseReconnects when an instance
  tried to be started against an instance that is already run.
Totktonada added a commit that referenced this issue Dec 12, 2018
Updated constants to be in sync with tarantool IPROTO.
Added integration tests for the working JDBC functionality.
Fixed travis script to use tarantool 2.0 which is required for SQL.
Fixed failing user permission calls in tarantool initialization script.

Closes #39

----

Rebase fixes (Alexander Turenko):

* Start tarantool from the Java code in JDBC tests (use
  TarantoolControl).
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