Results 1 to 4 of 4

Thread: Updating a table in JSP

  1. #1
    Join Date
    Sep 2009
    Posts
    125

    Updating a table in JSP

    I want to update a table (Access database) in my JSP page, so I put the following code:

    Code:
    PreparedStatement stmt = connection.prepareStatement ("UPDATE employee SET name = 'XXX'"); 
    stmt.setInt (1, 1); 
    stmt.setString (2, "XX"); 
    stmt.setString (3, "XXX"); 
    stmt.executeUpdate ();
    but I get the following error:

    javax.servlet.ServletException: Index 1 is out of bounds

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Updating a table in JSP

    You should see the SQL data type field associated with the first variable in your PreparedStatement may be the inner query is lacking some fields. If this is not the case then may be due to the SQL type INTEGER, you should perhaps use setBigDecimal() or setShort() instead of setInt().

  3. #3
    Join Date
    Sep 2009
    Posts
    125

    Re: Updating a table in JSP

    I modified the code:
    Code:
    PreparedStatement stmt = connection.prepareStatement ("UPDATE employee SET id =?, Name =?, FirstName =?"); 
    stmt.setInt (1, 1); 
    stmt.setString (2, "xx"); 
    stmt.setString (3, "xx"); 
    stmt.executeUpdate ();
    so I no longer get the error message, but it also does not update the database!

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Updating a table in JSP

    This problem occurs because of an error with the Development Kit JIT compiler. To fix this problem, disable the JIT compiler before starting the server. If an application is updated while it is running, WebSphere Application Server automatically stops the application or only its changed components, updates the application logic, and restarts the stopped application or its components. To minimize the occurrence of such errors, update applications in a test environment before updating the applications in a production environment.

    Source: ibm.com

Similar Threads

  1. Replies: 5
    Last Post: 27-08-2011, 10:53 AM
  2. Link a Table to another Table to Drop Down In Main Table
    By himeshRES in forum Windows Software
    Replies: 6
    Last Post: 11-12-2010, 02:01 PM
  3. Replies: 4
    Last Post: 30-11-2010, 03:01 AM
  4. To convert a pivot table to a flattened table in MS Excel
    By zeemga in forum Windows Software
    Replies: 3
    Last Post: 27-11-2010, 06:48 AM
  5. How to copy one table data into another table directly?
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 22-09-2009, 03:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,002,054.19203 seconds with 16 queries