Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data Service problem

 
fahad siddiqui
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using struts with data service for DB handling.
DB is MS SQL 2000.

I use a stored procedure to insert rows in the table.
I use Dataservice.setData("stored proc name ",hashmap);

This inserts the rows in db but throws an SQL exception and says no rows affected.

Please advise a possible solution.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What SQLException is thrown? Can you post a stack trace?
 
fahad siddiqui
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is the stack trace obtained.


ERROR 2006-09-05 10:22:33,304 [http8080-Processor24] (ProductManager.java) (com.echostar.cscsearch.manager.ProductManager) createProductType():84 - ProductManager()java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]No rows affected.

at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)

at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.executeUpdate(Unknown Source)

at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:196)

at com.its.util.SQLHelper.setData(SQLHelper.java:969)

at com.its.util.SQLHelper.setData(SQLHelper.java:958)

at com.its.util.DataService.setData(DataService.java:710)

at com.its.util.DataService.setData(DataService.java:736)

at com.echostar.cscsearch.manager.ProductManager.createProductType(ProductManager.java:82)

at com.echostar.cscsearch.struts.actions.ProcessProductAction.saveNewProductType(ProcessProductAction.java:167)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)

at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)

at com.its.actions.DataAction.executeAction(DataAction.java:294)

at com.its.actions.DataAction.execute(DataAction.java:67)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

at com.echostar.cscsearch.utils.BaseActionServlet.process(BaseActionServlet.java:50)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)

at java.lang.Thread.run(Thread.java:534)
 
fahad siddiqui
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This problem was solved by changing DataService.setData to DataService.getData.

But i was not able to grasp the funda behind this change.
 
fahad siddiqui
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This problem was solved by changing DataService.setData to DataService.getData.

But i was not able to grasp the funda behind this change.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic