Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 08-10-2009
Member
 
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:

Quote:
javax.servlet.ServletException: Index 1 is out of bounds
Reply With Quote
  #2  
Old 08-10-2009
Member
 
Join Date: May 2008
Posts: 2,383
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().
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 08-10-2009
Member
 
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!
Reply With Quote
  #4  
Old 08-10-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Updating a table in JSP"
Thread Thread Starter Forum Replies Last Post
Unable to work with table columns in opera browser when the table has wide layout Janya Technology & Internet 5 27-08-2011 10:53 AM
Link a Table to another Table to Drop Down In Main Table himeshRES Windows Software 6 11-12-2010 02:01 PM
Colonizing a table of employees from a table of applicants in Microsoft Access laplapye Windows Software 4 30-11-2010 03:01 AM
To convert a pivot table to a flattened table in MS Excel zeemga Windows Software 3 27-11-2010 06:48 AM
How to copy one table data into another table directly? ComPaCt Software Development 3 22-09-2009 03:54 PM


All times are GMT +5.5. The time now is 08:32 PM.