title: Java SQL Exception: Error when parsing callable statement <missing parameter type>
body: <p>I'm trying to call a MySQL stored procedure from within a Java application. However I receive the following error: <code>java.sql.SQLException: Internal error when parsing callable statement metadata (missing parameter type)</code>. </p>
  
  <p>The stored procedure functions correctly when called from outside the application. Also, the application does successfully connect to the database.</p>
  
  <ul>
  <li>MySQL Server: 5.5.27</li>
  <li>java version "1.7.0_15" </li>
  <li>Java(TM) SE Runtime Environment (build 1.7.0_15-b03)</li>
  <li>Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)</li>
  </ul>
  
  <p>Any assistance would be greatly appreciated. Thanks!</p>
  
  <p>Java Code:</p>
  
  <pre><code>protected Connection mysql;
  ...
  try {
      CallableStatement query = this.mysql.prepareCall("{call spInsertUser(?,?,?,?,?,?,?)}");
      query.setString(1, "user");
      query.setString(2, "password");
      query.setString(3, "test");
      query.setString(4, "test");
      query.setString(5, "test");
      query.setString(6, "test");
      query.setString(7, "test");
      query.execute();
      query.close();
      this.mysql.close();
  }
  catch (SQLException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>MySQL store procedure</p>
  
  <pre><code>CREATE DEFINER = `root`@`localhost` PROCEDURE `spInsertUser`(IN `nick` varchar(30),IN `pass` varchar(255),IN `param1` varchar(255),IN `param2`varchar(255),IN `param3` varchar(22), IN `param4` varchar(255), IN `param5` varchar(255))
      SQL SECURITY INVOKER
  BEGIN
    DECLARE uid INT DEFAULT 0;
  
    # check if nick exists
    DECLARE userExists INT DEFAULT 0;
    SELECT count(*) INTO userExists FROM users WHERE nick = nick;
    IF (userExists &gt; 0) THEN
      # do nothing if nick already exists
      # SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'User already exists!';
    ELSE
      # if nick doesn't exist, insert it
      INSERT INTO users (nick, pass, param1, created, active, param2) VALUES (nick, pass, param1, UNIX_TIMESTAMP(), 0, param2);
      SELECT LAST_INSERT_ID() INTO uid;
  
      IF (uid IS NOT NULL AND uid &gt; 0) THEN
        # create email
        INSERT INTO emails (uid, email) VALUES (uid, email);
      END IF;
    END IF;
  END
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>java.sql.SQLException: Internal error when parsing callable statement metadata (missing parameter type)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
  at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1836)
  at com.mysql.jdbc.DatabaseMetaData.getProcedureOrFunctionColumns(DatabaseMetaData.java:4305)
  at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:4146)
  at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:856)
  at com.mysql.jdbc.CallableStatement.&lt;init&gt;(CallableStatement.java:629)
  at com.mysql.jdbc.JDBC4CallableStatement.&lt;init&gt;(JDBC4CallableStatement.java:47)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
  at java.lang.reflect.Constructor.newInstance(Unknown Source)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  at com.mysql.jdbc.CallableStatement.getInstance(CallableStatement.java:523)
  at com.mysql.jdbc.ConnectionImpl.parseCallableStatement(ConnectionImpl.java:4313)
  at com.mysql.jdbc.ConnectionImpl.prepareCall(ConnectionImpl.java:4397)
  at com.mysql.jdbc.ConnectionImpl.prepareCall(ConnectionImpl.java:4371)
  at pack.File.method(File.java:65)
  </code></pre>