Bug #16894 "Incorrect arguments to mysql_stmt_execute" - better error message pls (stream)
Submitted: 30 Jan 2006 11:44 Modified: 3 Mar 2006 11:37
Reporter: Ralf Hauser Email Updates:
Status: No Feedback Impact on me:
Category:MySQL Server: Prepared statements Severity:S3 (Non-critical)
Version:4.1/5.0/5.1 OS:Linux (linux)
Assigned to: CPU Architecture:Any

[30 Jan 2006 11:44] Ralf Hauser
Got ..java.sql.SQLException: Incorrect arguments to mysql_stmt_execute
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851)
  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
  at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1974)
  at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1897)
  at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1758)

that doesn't help much

How to repeat:
the issue was that upon inserting a blob, the stream was already read until the end.

Suggested fix:
1) say which of the arguments caused the error
2) probably, it would even be possible to say something like:

"empty stream received - reset() first?"
[30 Jan 2006 15:17] Mark Matthews
That error message comes from the server, so changing category as such.
[31 Jan 2006 8:08] Valeriy Kravchuk
Please, specify the exact version of server and Connector/J used. Try to repeat with latest (5.0.18, in case of 5.0.x server branch) versions generally available, and inform about the results.
[1 Feb 2006 17:07] Ralf Hauser
/usr/sbin/mysqld  Ver 4.1.13-standard-log for pc-linux-gnu on i686 (MySQL Community Edition - Standard (GPL))


if we find time, we'll update to 5.0

Anyway, at leat no SQLWarnings were issued that we could catch with the below code:

    public static void dumpSqlWarnings(ResultSet rs) throws SQLException {
        if (rs != null) {
            SQLWarning sqWarn = rs.getWarnings();
            if (sqWarn != null) {

    public static void dumpSqlWarnings(PreparedStatement stmt)
            throws SQLException {
        if (stmt != null) {
            SQLWarning sqWarn = stmt.getWarnings();
            if (sqWarn != null) {

    public static void dumpSqlWarnings(SQLWarning sqWarn) {
        log.debug("sqw - errCode: " + sqWarn.getErrorCode());
        dumpSqlWarnings(sqWarn.getNextWarning()); // possibly need to
        // avoid recursion
        dumpSqlExceptions(sqWarn.getNextException());// possibly need
        // to avoid recursion

    public static void dumpSqlExceptions(SQLException sqExcept) {
        if (sqExcept != null) {
            log.debug("sqe - errCode: " + sqExcept.getErrorCode());
            log.debug("sqExcept.getSQLState(): " + sqExcept.getSQLState());
            log.debug("sqExcept.getLocalizedMessage(): "
                    + sqExcept.getLocalizedMessage());
            dumpSqlExceptions(sqExcept.getNextException());// possibly need to
            // avoid recursion
[3 Feb 2006 11:37] Valeriy Kravchuk
Please, try to repeat with a newer version of Connector/J (http://dev.mysql.com/downloads/connector/j/3.1.html) and inform about the results. I also cvhanged category, as it is JDBC-related and not a server-related problem.
[4 Mar 2006 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".