tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Lee Deliang" <just_dar...@hotmail.com>
Subject I am really stumped at this one any1?
Date Mon, 10 Jul 2000 18:10:44 GMT

I have problems trying to write data into my MS SQL Server database. Here is 
the codes in my java bean that calls and writes to it:

String SQLstatement ="INSERT INTO ApplicationRecord VALUES('?', '?', '?', ?, 
?, ?, ?, ?, ?, ?, ?, '?', '?', ?, ?, ?, '?', '?')";

try
{
	addcon.setAutoCommit(false);
	PreparedStatement stm = addcon.prepareStatement(SQLstatement);
	stm.setString(1, getAppNo());
	stm.setString(2, getUserNRIC());
	stm.setString(3, getCourseNo());
	stm.setDouble(4, appmanHrs);
	stm.setInt(5, appmanDays);
	stm.setTimestamp(6, appstartDate);
	stm.setTimestamp(7, appendDate);
	stm.setTimestamp(8, appDeadline);
	stm.setDouble(9, getAppFees());
	stm.setDouble(10, appfeesPaid);
	stm.setDouble(11, getAppotherCosts());
	stm.setString(12, getAppclaimDetails());
	stm.setString(13, getAppRemarks());
	stm.setBoolean(14, appsupervisorApproval);
	stm.setBoolean(15, appdirectorApproval);
	stm.setBoolean(16, appAttendance);
	stm.setString(17, appsuperNRIC);
	stm.setString(18, appdirectorNRIC);

	stm.executeUpdate();
	System.out.println(" Inserting Data Successful");

	addcon.commit();
	con.setAutoCommit(true);

	stm.close();
	addcon.close();
}
catch(SQLException ex)
{
	System.err.println("SQLException: " + ex.getMessage());
	if(addcon != null)
	{
		try
		{
			System.err.println("Transaction is being rolled back");
			addcon.rollback();
		}
		catch(SQLException excep)
		{
			System.err.println("SQLException: " + excep.getMessage());
		}
	}
}

i get the following error in my browser:

Internal Servlet Error:

javax.servlet.ServletException
	at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:386)
	at 
jsp.RetrainingWebApp._0002fjsp_0002fRetrainingWebApp_0002fconfirmed_0002ejspconfirmed_jsp_1._jspService(_0002fjsp_0002fRetrainingWebApp_0002fconfirmed_0002ejspconfirmed_jsp_1.java:124)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
	at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
	at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
	at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
	at 
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
	at java.lang.Thread.run(Unknown Source)

Root cause:
java.lang.ArrayIndexOutOfBoundsException
	at sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(Unknown Source)
	at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setNull(Unknown Source)
	at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setString(Unknown Source)
	at Retraining.ApplyCourses.addRecord(ApplyCourses.java:374)
	at 
jsp.RetrainingWebApp._0002fjsp_0002fRetrainingWebApp_0002fconfirmed_0002ejspconfirmed_jsp_1._jspService(_0002fjsp_0002fRetrainingWebApp_0002fconfirmed_0002ejspconfirmed_jsp_1.java:91)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
	at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
	at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
	at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
	at 
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
	at java.lang.Thread.run(Unknown Source)

Can any1 kindly tell me what is wrong?

Darren
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message