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

RegisterOutParameter Problem in java?

mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

I am using the fallowing code to call the Function written in Oracle but it is showing compilation errors



Oracle function is:


This code is in package called PACKAGE_EMP
which has the cursor ref as

I am getting the exception
Error(35,57): identifier OracleTypes not found
Error(97,43): identifier OracleTypes not found

I am using Jsp as view, servlet as contriller , and my DB connection logic in Java Class(Above code) Please help me
Thanks in advance
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Dont remember it well, but shouldnt you be using oracle.jdbc.OracleTypes instead?
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

Sridhar Santhanakrishnan wrote:Dont remember it well, but shouldnt you be using oracle.jdbc.OracleTypes instead?

I don't get it but i also try with OracleTypes.CURSOR instead of oracle.jdbc.OracleTypes.CURSOR.
I am using JDevloper 11.0.2 is there any need to add libraries or some thing
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
You would have to add the ojdbc jars to the classpath.
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

I added ojdbc14.jsr file in execution it throws an exception
java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:116)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:177)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:233)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:407)
at oracle.jdbc.driver.CharCommonAccessor.getInt(CharCommonAccessor.java:140)
at oracle.jdbc.driver.T4CVarcharAccessor.getInt(T4CVarcharAccessor.java:779)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:712)
at com.garnet.employee.CallStoredPackage.showAll(CallStoredPackage.java:44)
at com.garnet.employee.EmployeeControllerServlet.doPost(EmployeeControllerServlet.java:53)
at com.garnet.employee.EmployeeControllerServlet.doGet(EmployeeControllerServlet.java:21)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

Please help me
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
This means you are trying to get a field of one data type as another datatype. For ex. you are calling rs.getInt() for a field that is a date.

Just check the individual data types of the columns returned in the resultset.
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

OK thanks i forget the field in my package,that cause problem
Thanks for response...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RegisterOutParameter Problem in java?