This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Callable statement in Servlet throws exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Callable statement in Servlet throws exception" Watch "Callable statement in Servlet throws exception" New topic
Author

Callable statement in Servlet throws exception

carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Hi i am trying to call a procedure from servlet but getting sql exception, my procedure is working fine ,i am able to connect to the database but unable to make out why am i getting these exceptions
Servlet [code]

CallableStatement cstmt = d.connection.prepareCall("{call sp_rs_AreaCodeMasterDMLs(?,?,?,?,?,?,?,?,?,?,?,?,?)}");
cstmt.setLong(1,areacodeplotid);
cstmt.setString(2, areacode);
cstmt.setString(3,plotno);
cstmt.setString(4,muncipalityareacode);
cstmt.setString(5,muncipalityplotno);
cstmt.setInt(6,Integer.parseInt(insewernetworkrange));


if(phase.equalsIgnoreCase(null))
{
System.out.println("inside if"+phase);
cstmt.setInt(7,0);
}
else
{
System.out.println("inside else"+phase);
cstmt.setInt(7,Integer.parseInt(phase));


}

cstmt.setString(8,username);

cstmt.setInt(9,Integer.parseInt(comment));
cstmt.setString(10,userdefcomment);
cstmt.setString(11,dmlaction);
cstmt.setString(12,copydetail);
cstmt.setString(13,rowstatus);

System.out.println(areacodeplotid+" "+areacode+ " "+plotno+" "+muncipalityareacode+" "+muncipalityplotno+" "+insewernetworkrange+" "+comment+" "+userdefcomment+" "+dmlaction+" "+copydetail+" "+rowstatus);

cstmt.execute();

d.connection.close();



and the execption that i am getting is

java.sql.SQLException: No Action specified to be Performed on AreaCode Master!
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:636)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:562)
at PlotManagement.AddNewPlot.doGet(AddNewPlot.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)


Can anybody please help me out with this issue.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

You have successfully called your stored procedure.
But your stored procedure has thrown an exception.
You will have to check - in the stored procedure, not in your java code - why this exception is thrown.


OCUP UML fundamental and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Callable statement in Servlet throws exception
 
Similar Threads
JBOSS keeps creating the UDP socket connections without closing it
Call Stored Procedure Returning Cursor as Output
Login Authentication & sendRedirect
Passing array input in procedure - thin driver
Passing Date in Callable Statement