java - MySQL CallableStatement.getObject have inconsistent behavior -
i have following simple procedure defined within in test schema, _test_jdbc_inconsistency
, in instance of mysql on development system
create procedure _test_jdbc_inconsistency.proc(in param1 boolean, out param2 boolean) begin if (param1 null) set param2 = null; else set param2 = not param1; end if; end
but surprise, following simple test fails
@test(dataprovider = "connectionpool") public void testjdbcinconsitencyoutparametertype(connection con) throws sqlexception, ioexception { con.setcatalog("_test_jdbc_inconsistency"); try (callablestatement statement = con.preparecall("{call proc(?, ?)}")) { statement.setint("param1", 5); statement.registeroutparameter("param2", types.integer); statement.execute(); asserttrue(statement.getobject(2) instanceof integer); assertequals(statement.getobject(2), 25); asserttrue(statement.getobject("param2") instanceof integer); } }
the inconsistency flagged on last asserttrue
statement; while calling overload of callablestatement.getobject
accepts parameter-index returns result of expected type (java.lang.integer
), other overload accepting parameter-name returns inconsistent result of type java.lang.long
. since i'm using signed integers , based on many instructions on using out parameters jdbc, 1 provided mysql documentation, process seems correct , looks inconsistent behavior.
can else confirm issue?
my environment:
- windows 8.1 x64
- jdk 1.8.0_45 (x64/x86)
- mysql connector/j 5.1.34
- mysql server 5.6.24
- testng 6.9.5
since there have been no comment or response, reported mysql bug database , it's been accepted , verified bug. here link issue interested:
Comments
Post a Comment