Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4111800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:06:46+00:00 2026-05-20T22:06:46+00:00

I am having a strange problem with MySQL Stored Procedure. I have written a

  • 0

I am having a strange problem with MySQL Stored Procedure.

I have written a simple stored procedure as follows:

{

    DELIMITER $$

    CREATE DEFINER=`username`@`%` PROCEDURE `sp_create_my_log`(IN source TEXT,
      OUT my_id INT)
    BEGIN
      --
      -- insert record and return primary key
      INSERT INTO my_log (source) VALUES (source);
      SET my_id = LAST_INSERT_ID();

      COMMIT;
    END
}

This stored procedure is running absolutely fine on my local machine (MySQL Server 5.1, Windows XP). But when I try to run it on the server, I get the following error:

java.sql.SQLException: Parameter index of 2 is out of range (1, 0)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
    at com.mysql.jdbc.CallableStatement$CallableStatementParamInfo.checkBounds(CallableStatement.java:274)
    at com.mysql.jdbc.CallableStatement.checkParameterIndexBounds(CallableStatement.java:710)
    at com.mysql.jdbc.CallableStatement.checkIsOutputParam(CallableStatement.java:672)
    at com.mysql.jdbc.CallableStatement.registerOutParameter(CallableStatement.java:1846)
    at org.apache.commons.dbcp.DelegatingCallableStatement.registerOutParameter(DelegatingCallableStatement.java:95)
    at org.apache.commons.dbcp.DelegatingCallableStatement.registerOutParameter(DelegatingCallableStatement.java:95)
    at com.mycomp.myprj.importer.ImporterImpl.onPreLoad(ImporterImpl.java:160)
    at com.mycomp.myprj.importer.csv.FileImporter.load(FileImporter.java:43)
    at com.mycomp.myprj.importer.csv.MyImporter.main(MyImporter.java:82)
0.843 seconds

Any idea why this is happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:06:46+00:00Added an answer on May 20, 2026 at 10:06 pm

    Just a wild guess (I’m more an Oracle than a MySQL kind of guy):
    – Did you perhaps declare your parameter in Java wrong? (my_id is declared as an out parameter in the stored procedure, do the signatures in Java and MySQL match?)
    – What happens if you call your procedure from the MySQL command line interface?

    Kind regards, Frank

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a rather strange problem with MySQL. Trying to create a procedure to
I am having some strange problem. I have written a small module in VC++
I am having a very strange problem in a simple program and have been
I'm having a strange problem. I have to use GetPostBackEventRefence to force a Postback,
I'm having a strange problem here... I have an ASP.NET 3.5 application that has
I'm having a strange problem with MySQL and would like to see if the
I am having a strange problem. I am using PDO prepared statement. I have
I am having a strange problem in my code. I have many asserts scattered
I'm having a strange problem in Visual Studio 2008 where my Pending Checkins window
I am having a problem with my SQL Server 2005 where stored procs, specifically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.