File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Pass Array From to Java to Stored Procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Pass Array From to Java to Stored Procedure" Watch "Pass Array From to Java to Stored Procedure" New topic
Author

Pass Array From to Java to Stored Procedure

thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
Oracle database version you are using = Oracle9i
Java version you are using = jdk 1.4
JDBC driver (and version) you are using = thin driver





I have declared an array of numbers in package.


/


I am trying to call applychangesrollupdown procedure from java program using callable statement.

Is there anybody having the solution for this problem? I am not able to find out the solution which should work with websphere environment and it should throw any exception or error.

My java code is as follows:







ERROR STACK :





2005-07-01 18:37:25,208 [Servlet.Engine.Transports : 0] ERROR com.sbc.dcomm.ui.utility.DcExceptionHandler - Exception encountered:
java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:108)
at com.sbc.dcomm.ui.pa.dao.PACartItemDAO.applyRollupRolldown(PACartItemDAO.java:236)
at com.sbc.dcomm.ui.pa.business.PAService.applyRollupRolldown(PAService.java:336)
at com.sbc.dcomm.ui.pa.actions.PAAction.applyChanges(PAAction.java:382)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at com.sbc.dcomm.ui.utility.DcRequestProcessor.process(DcRequestProcessor.java:39)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
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.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at com.sbc.dcomm.ui.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:105)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
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:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)



[moved code tags to surround code]
[ July 02, 2005: Message edited by: Jeanne Boyarsky ]
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Thomas,
I'm only guessing here, but the "java.sql.Connection" parameter you pass to the "ArrayDescriptor" constructor, needs to be an "OracleConnection" and not a "com.ibm.ws.rsadapter.jdbc.WSJdbcConnection". That's why you are getting a "ClassCastException".

I don't use "WebSphere", but "WSJdbcConnection" is probably a "wrapper" for a "java.sql.Connection". You probably need to extract the "Connection" from the wrapper, and pass that to the "ArrayDescriptor" constructor. But since I don't use "WebSphere", I can't tell you how to do that -- sorry!

Good Luck,
Avi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pass Array From to Java to Stored Procedure
 
Similar Threads
Problem with WAS 5.1
Accessing 2 CMPs which connected to 2 databases from the same session bean method...
I am trying to use jdbc to call sp procedure in UDB 8.1
Hibernate error
Passing array input in procedure - thin driver