[CONJ-416] IllegalArgumentException with getTimestamp Created: 2017-01-26 Updated: 2019-09-13 Resolved: 2019-09-13 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 1.5.7 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Robin K | Assignee: | Diego Dupin |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 16.04, Mac OSX |
||
| Description |
|
We are experiencing an Issue when using the following Setup (on multiple machines):
When reading timestamps from a result set (MariaSelectResultSet) via MariaSelectResultSet.getTimestamp, we are receiving the following exception:
However, the exception seems to ONLY appear if we include a WHERE clause in the SQL statement. Reading the (very) same timestamps without WHERE leads to no errors. Also, I cannot see any difference between the timestamps when printing the values with getObject or getString instead of getTimestamp. Receiving the timestamps with getString and parsing them to a java.sql.Timestamps after works without issues. The timestamps are stored with the type timestamp(2). The same code works with an MySQL driver without any issues (the initial reason for us to use the MariaDB driver was that we wanted to support milliseconds, which could not be inserted into MariaDB with the MySQL driver). |
| Comments |
| Comment by Diego Dupin [ 2017-01-26 ] | ||||||||||||||||
|
Hi Robin. I don't see any weird things in code. I'll have to dig how that can occur. If you have the possibility, could you :
thanks | ||||||||||||||||
| Comment by Robin K [ 2017-01-26 ] | ||||||||||||||||
|
Hi Diego, thanks for your reply.
323031362D30352D30392031333A34303A35312E3031 (failing timestamp) Edit:
| ||||||||||||||||
| Comment by Diego Dupin [ 2017-01-26 ] | ||||||||||||||||
|
the hexadecimal value "323031362D30352D30392031333A34303A35312E3031" correspond to "2016-05-09 13:40:51.01" string in hexadecimal. (so, driver is using text format). In binary format, same date would have been "E00705090D283310270000". if you reproduced the error with mysql too, there must be an error server side, not driver side. >the timestamp that leads to the error is received via a GREATEST () statement (including multiple COALESCEs: GREATEST (COALESCE(m_slc.lastchange, 0), ...)) I'll try to reproduced it with those functions | ||||||||||||||||
| Comment by Robin K [ 2017-01-26 ] | ||||||||||||||||
|
>Have you reproduced an issue with text format too ? or it's just misconfiguration (using useServerPrepStmts=false then) ? using 'useServerPrepStmts=false' indeed seems to have fixed the issue, thanks! So is this a misbehavior of the driver or intended and the issue is a wrong configuration on our side? Can you explain how exactly that is the case? My understanding from reading the docs is that the option is used to increase performance: "Queries are prepared on the server side before executing, permitting faster execution next time." | ||||||||||||||||
| Comment by Diego Dupin [ 2017-01-26 ] | ||||||||||||||||
|
sorry, i wasn't clear.
When using option useServerPrepStmts=true, first execution of a command, a PREPARE command will be executed. So first command will be slower. but then, PREPARE results stay in cache, and other command will be faster. Other improvement, is that data exchange on network level are smaller : This issue (seen because of stacktrace) concern only binary protocol. Server might have send text protocol result !? Server doesn't have any issue of that kind actually, but the hexadecimal value "323031362D30352D30392031333A34303A35312E3031" would create exactly that kind of problem. (nanosecond value would be > 999999999) Since you seem to reproduce the problem, can you send a SQL command that create this issue ? | ||||||||||||||||
| Comment by Robin K [ 2017-01-27 ] | ||||||||||||||||
|
Unfortunately, the SQL-Query is quite large and I was not able to reproduce the error with a minimal example just yet. It includes the timestamp generated with GREATEST(COALESCE(...), ...) and multiple GROUP_CONCATs. My next guess was that it had something to do with the GROUP_CONCATs, which are indeed using timestamps in text format that are later parsed to a sql.Timestamp object. I could not reproduce this though. Is there a possibility that this is related? I will try to find out at which point it breaks when I find time. | ||||||||||||||||
| Comment by Diego Dupin [ 2019-09-13 ] | ||||||||||||||||
|
Closing since not reproduced. Feel free to create another issue link to this one if this occurs. |