Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
2.6.0
-
None
-
MariaDB 10.4.7, RHEL 7
Description
I have a SP as follows. It simply sets the output parameters to a fix value.
DELIMITER $$
DROP PROCEDURE IF EXISTS `test_SP` $$
CREATE PROCEDURE `test_SP`(
IN para1 BIGINT,
IN para2 nvarchar(1000),
OUT para3 NVARCHAR(10),
OUT para4 NVARCHAR(80),
OUT para5 NVARCHAR(80),
OUT para6 datetime,
OUT para7 datetime,
OUT para8 datetime,
OUT para9 datetime
)
BEGIN
SET para3 := 'PARAM 3';
SET para4 := 'PARAM 4';
SET para5 := 'PARAM 5';
SET para6 := '2006-01-01 01:01:16';
SET para7 := '2007-02-02 02:02:17';
SET para8 := '2008-03-03 03:03:18';
SET para9 := '2009-09-22 13:45:19';
END $$
DELIMITER ;
I have a Java program (see TestGetDateTime.java attached) to run the SP and retrieve the datetime values using getDate() and getTime(). All output parameter values can be retreived correctly as follows:
param3=PARAM 3
param4=PARAM 4
param5=PARAM 5
param6=2006-01-01 01:01:16
param7=2007-02-02 02:02:17
param8=2008-03-03 03:03:18
param9=2009-09-22 13:45:19
Then I have a same Java program (see TestTimestamp.java), but using getTimestamp() instead to get the datetime values. It fails to get all output parameters and the datetime values are incorrect (see param6 & param7) as follows:
param3=PARAM 3
param4=PARAM 4
param5=PARAM 5
param6=2008-03-03 03:03:18.0
param7=2009-09-22 13:45:19.0
java.sql.SQLDataException: No such column: 8
at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.checkObjectRange(SelectResultSet.java:630)
at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getTimestamp(SelectResultSet.java:1124)
at org.mariadb.jdbc.CallableProcedureStatement.getTimestamp(CallableProcedureStatement.java:364)
at TestGetTimestamp.main(TestGetTimestamp.java:53)
However, I have tried the MySQL Connector/J, there is no problem using getTimestamp(), I can get all values correctly.
Please investigate the problem.
The source of SP and Java are attached for reference.