Trouble Editing Data on iSeries from Web Application
0 pts.
0
Q:
Trouble Editing Data on iSeries from Web Application
Hello. I'm having a problem editing data in a database file on my AS400. I have an application server set up on the same machine and I've created a data source to access the files in my library. The provider is "DB2 for OS400 V5R1 JDBC Provider", the database name is "*LOCAL" and the library name is correct. I can use a SELECT statement with the data source without issue, but when I try UPDATE, DELETE OR INSERT, I get an error message.

This is my code to access the file:
DataSource ds = (DataSource) (new InitialContext()).lookup("jdbc/<dataSourceName>");
Connection as400System = ds.getConnection("<userid>", "<password>");

This is my code to delete a record:
PreparedStatement editRecordPS = as400System.prepareStatement("DELETE FROM <fileName> WHERE <condition>");
editRecordPS.execute();

Thanks in advance for your help. I appreciate it. I've listed the error from error log below:

com.ibm.db2.jdbc.app.DB2DBException: <fileName> in <libraryName> not valid for operation.

at java.lang.Throwable.<init>(Throwable.java:195)
at java.lang.Exception.<init>(Exception.java:41)
at java.sql.SQLException.<init>(SQLException.java:40)
at com.ibm.db2.jdbc.app.DB2DBException.<init>(DB2DBException.java:47)
at com.ibm.db2.jdbc.app.DB2PreparedStatementRuntimeImpl.SQLExecute(Native Method)

at com.ibm.db2.jdbc.app.DB2PreparedStatementRuntimeImpl.execute(DB2PreparedStatementRuntimeImpl.java:236)

at com.ibm.db2.jdbc.app.DB2PreparedStatement.execute(DB2PreparedStatement.java:1822)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.execute(WSJdbcPreparedStatement.java:400)

at PresentationEdit.doPost(PresentationEdit.java:78)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)

at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)

at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)

at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)

at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)

at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)

at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)

at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1038)

at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:603)

at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)

at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)

at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)

at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)

at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)

at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)

at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)

at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)

at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:449)
ASKED: Oct 5 2005  12:17 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
0 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
I know this is simple and is most likely not the solution but have you checked the profiles authority to the objects?
Last Answered: Oct 31 2005  3:17 AM GMT by bigaub   0 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

TomLiotta   7920 pts.  |   Nov 14 2009  10:00PM GMT

Is the file journaled? If not, then the error is probably what you should see. You may have the connection defined under commitment control and need to turn it off. (It should be on, which means journaling should be established.)

Tom

 
0