-
How to Edit Data on iSeries
Hello. I posted the same topic yesterday and didn't receive any replies. I've tried to be more specific and hopefully someone can help me. 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(DB2PreparedStatementRuntimeIm pl.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.jav a: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(ValidServletReferenceS tate.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference .java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestD ispatcher.java:1038)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.ja va:603)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.jav a: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(CachedInvocatio n.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)
Similar Threads
-
By Kathleen Dollard in forum .NET
Replies: 14
Last Post: 05-03-2002, 12:10 AM
-
By Tim Frost in forum xml.announcements
Replies: 0
Last Post: 04-02-2001, 10:53 AM
-
By sb in forum VB Classic
Replies: 0
Last Post: 07-22-2000, 04:07 AM
-
By William Gaddam in forum VB Classic
Replies: 1
Last Post: 05-02-2000, 09:19 PM
-
By Dan in forum VB Classic
Replies: 0
Last Post: 03-17-2000, 05:14 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks