Skip to content

jdbc: connection may appear hang in case of connection issues #38

Closed
@ztarvos

Description

@ztarvos

I tried to use jdbc and the firewall was preventing the connection. The application seemed to hang.
Although, as I found out later, it actually was the effect of some OS-defined timeout,
it would be good to set meaningful timeout in the jdbc driver, especially when default socket provider is used.

Also, the exception thrown is not SQLException that one would expect from the jdbc driver.

Exception in thread "main" org.tarantool.CommunicationException: Couldn't connect to tarantool at org.tarantool.TarantoolBase.<init>(TarantoolBase.java:76) at org.tarantool.TarantoolConnection.<init>(TarantoolConnection.java:18) at org.tarantool.jdbc.SQLDriver$1.<init>(SQLDriver.java:51) at org.tarantool.jdbc.SQLDriver.connect(SQLDriver.java:51) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:270) at TestJdbc.main(TestJdbc.java:10) Caused by: java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197) at java.io.DataInputStream.readFully(DataInputStream.java:169) at org.tarantool.TarantoolBase.<init>(TarantoolBase.java:45) ... 6 more

I propose:

  • to set the timeout for default socket provider.
  • make exception compliant to specification.
  • implement control over timeouts in the driver as per specification (i.e. Connection.setNetworkTimeout, Statement.setQueryTimeout) or at least provide a connection property for that purposes.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions