← Back to team overview

maria-developers team mailing list archive

Re: JDBC getWarnings and stored procedure

 

Hello Daniel,
In fact, getWarnings works fine when there is no error.
The following procedure issues one warning and one error, and in this case getWarnings() (called inside SQLException catch) returns null even with reenableWarnings().

create or replace procedure pwarning1()
begin
  SIGNAL SQLSTATE '01000';
  RESIGNAL SET MESSAGE_TEXT = 'error message';
end
/

Regards,
Jérôme.



> -----Message d'origine-----
> De : Maria-developers [mailto:maria-developers-
> bounces+j.brauge=qualiac.com@xxxxxxxxxxxxxxxxxxx] De la part de Daniel
> Black
> Envoyé : mercredi 5 avril 2017 03:09
> À : maria-developers@xxxxxxxxxxxxxxxxxxx; Diego Dupin
> Objet : Re: [Maria-developers] JDBC getWarnings and stored procedure
> 
> 
> 
> On 03/04/17 20:21, jerome brauge wrote:
> > Hello,
> >
> > When we call a stored procedure in JDBC which emit warnings,
> > getWarnings() always returns null.
> >
> > I don't really think that the problem is in MariaDB Connector J
> > because warning flag in the EOF packet is not set to true.
> >
> 
> hasWarnings is set:
> 
> https://github.com/MariaDB/mariadb-connector-
> j/blob/master/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractC
> onnectProtocol.java#L745
> 
> 
> Its used here:
> 
> https://github.com/MariaDB/mariadb-connector-
> j/blob/master/src/main/java/org/mariadb/jdbc/MariaDbConnection.java#L8
> 27
> 
> I suspect the bug is warningsCleared has a implicit default of false in the
> above class.
> 
> As a workaround check, call reenableWarnings() before getWarnings().
> 
> > Mysql client behaves in the same way, by default it shows warnings
> > count issued by DML command but not for stored procedure.
> >
> >
> >
> > Is it a normal behavior ?
> >
> >
> >
> > Best regards,
> >
> > Jérôme.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~maria-developers
> > Post to     : maria-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~maria-developers
> > More help   : https://help.launchpad.net/ListHelp
> >
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~maria-developers
> Post to     : maria-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~maria-developers
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References