Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

java.sql.SQLException: Parameter index out of range (0 < 1 ).

843859Mar 9 2007 — edited Mar 15 2007
I got this message " java.sql.SQLException: Parameter index out of range (0 < 1 ) " when i try to pass data from a servlet to mysql database using a stored procedure and callable statement. i have to pass 13 parameters stored in array.
Please help me
Here is the code

Connection con=null;
	CallableStatement proc = null;
    try 
	{
	  Class.forName("com.mysql.jdbc.Driver").newInstance();
      con = DriverManager.getConnection("jdbc:mysql:///projectclaire", "root", "");
      proc = con.prepareCall("{ call do_upcli(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) }");
	  for (int k=0;k <elts.length;k++)
      {
       proc.setString(k, elts[k]);
      } 
	  proc.setInt(13, b2);
	  proc.setInt(14, b3);
      proc.execute();
      response.sendRedirect("http://localhost:8080/uct/success3.jsp");;
	  proc.close();
	} 
   catch(Exception e) 
    {
      System.err.println("Exception: " + e.getMessage());
	  out.println(e);
	  out.println(e.getMessage());
	  
    } 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 12 2007
Added on Mar 9 2007
3 comments
1,380 views