aspose file tools*
The moose likes JDBC and the fly likes Data Service problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Data Service problem" Watch "Data Service problem" New topic
Author

Data Service problem

fahad siddiqui
Ranch Hand

Joined: Jun 14, 2006
Posts: 85
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30309
    
150

What SQLException is thrown? Can you post a stack trace?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
fahad siddiqui
Ranch Hand

Joined: Jun 14, 2006
Posts: 85
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

Joined: Jun 14, 2006
Posts: 85
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

Joined: Jun 14, 2006
Posts: 85
This problem was solved by changing DataService.setData to DataService.getData.

But i was not able to grasp the funda behind this change.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Data Service problem