How to access oracle cursors using jdbc (expecting ur earliest reply)

Hi All,
can anyone help me out by giving me an idea or sample code in accessing the cursors that are defined in the oracle... i have to access those cursors using java... Thanks in advance for your reply and time....
Ragu

I have tried to follow the example from the URL link you provided.
I'm using :
- Oracle 8.1.6/8.1.7
- JDK 1.3.1
I've created:
create or replace package types
as
type cursorType is ref cursor;
end;
create or replace function sp_ListEmp return types.cursortype
as
l_cursor types.cursorType;
begin
open l_cursor for
select ename, empno
from emp
order by ename;
return l_cursor;
end;
Then I have on my code the following:
import java.sql.*;
import oracle.jdbc.driver.*;
String conStatus = "":
String driver_class = "oracle.jdbc.driver.OracleDriver";
String connect_string = "jdbc:oracle:thin:@slackdog:1521:oracle8";
String query = "begin :1 := sp_listEmp; end;";
Connection conn;
Class.forName(driver_class);
conn = DriverManager.getConnection(connect_string, "scott", "tiger");
try{
conStatus = "before prepareCall, ";
CallableStatement cstmt = conn.prepareCall(query);
conStatus = conStatus + "before Register out, ";
cstmt.registerOutParameter(1,OracleTypes.CURSOR);
conStatus = conStatus + "before execute, ";
cstmt.execute();
conStatus = conStatus + "before getObject, ";
ResultSet rset = (ResultSet)cstmt.getObject(1);
while (rset.next ())
System.out.println( rset.getString (1) );
cstmt.close();
} catch (Exception e) {
conStatus = conStatus + e;
System.out.println(conStatus);
What happens is that I am able to successfully compile the code. But when I run the code, it displays:
"before prepareCall, before Register out, SQLException: incompatible types = -10."
What does that mean? Pls point out to me what I did wrong in my code.
Thanks.

Similar Messages

  • How to access Oracle database using UNIX?

    Hi,
    Does anyone know how to access Oracle database Oracle 8i that is hosted on unix server via unix command line?
    Thanks,
    Willy

    Well, Oracle probably has a command line tool. I think it's called sqlplus or somesuch. Check you Oracle docs.
    Of course, given that this is a Java forum, it's remotely possible that you're actually asking about accessing the database from a Java program.
    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/

  • How to implement Oracle DWH using JDBC

    Hello,
    i'm new to the Oracle database and i'm wondering how to implement a DWH Core or Datamart System using Oracle 11g Express. How can i "switch" a relational oracle database to a dimensional one, preparing it for OLAP/BI queries´, preferably using the JDBC interface ?
    Thanks a lot!

    An good introduction to Oracle OLAP is found on the OTN site: Oracle OLAP.
    --Ken Chin

  • How to access Oracle Using Dos Based FoxPro(2.5,2.6)

    Hello Sir,
    I need some clarification regarding the following question.
    Q. How can access Oracle Database using Dos Based Foxpro of version either 2.5 or 2.6
    Thanking you,
    Kishore.P

    Hi Alex,
    the host and port depends on your network setup of your VM.
    Do an ifconfig -a and see what IP adress your guest has.
    With this IP address you should be able to access EM from outside your VM (but on the VM host, not from outside the network) with the same port.
    Regards
    Sebastian

  • How to access Oracle Apps 11i forms using Vmware Player?

    Hi,
    I have installed Oracle Apps 11i on native OS OEL5 Server and guest OS Windows XPP using Vmware Player.Now how to access Oracle Apps 11i forms from Windows XPP using Vmware on my OEL5 Server Desktop?
    Thank's
    Regard's
    Rerry

    Hi,
    If you mean how to access eBusiness Suite from within the Virtual Machine, then you just navigate to the same URL you normally would. You may need to put the machine alias in your hosts file if you are referencing it via machine name rather than IP address.
    If you mean that you want to load the form in forms builder (for example) then you need to FTP the form from server to client (as you normally would) and then open it in your client (XP virtual machine).
    If you want to use Workflow Builder (as per your original requirement) then you need to ensure that the TNSNAMES.ora file in the Workflow Builder home has an entry for your instance on Linux, and then you should be able to connect to the database directly.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://www.workflowfaq.com/blog ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • Problem:I can't get oracle MajorVersion using jdbc in 9.2.0.1.0!

    I can't get oracle MajorVersion using jdbc in 9.2.0.1.0,how can i do and how many oracl version can't get MajorVersion?
    thanks,erveryone! online waiting

    What errors are you getting? Can you post the codew you are using to get MajorVersion.

  • How to prevent Oracle from using an index when joining two tables ...

    How to prevent Oracle from using an index when joining two tables to get an inline view which is used in an update statement?
    O.K. I think I have to explain what I mean:
    When joining two tables which have many entries sometimes it es better not to use an index on the column used as join criteria.
    I have two tables: table A and table B.
    Table A has 4.000.000 entries and table B has 700.000 entries.
    I have a join of both tables with a numeric column as join criteria.
    There is an index on this column in table A.
    So I instead of
      where (A.col = B.col)I want to use
      where (A.col+0 = B.col)in order to prevent Oracle from using the index.
    When I use the join in a select statement it works.
    But when I use the join as inline view in an update statement I get the error ORA-01779.
    When I remove the "+0" the update statement works. (The column col is unique in table B).
    Any ideas why this happens?
    Thank you very much in advance for any help.
    Regards Hartmut

    I think you should post an properly formatted explain plan output using DBMS_XPLAN.DISPLAY including the "Predicate Information" section below the plan to provide more details regarding your query resp. update statement. Please use the \[code\] and \[code\] tags to enhance readability of the output provided:
    In SQL*Plus:
    SET LINESIZE 130
    EXPLAIN PLAN FOR <your statement>;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);Usually if you're using the CBO (cost based optimizer) and have reasonable statistics gathered on the database objects used the optimizer should be able to determine if it is better to use the existing index or not.
    Things look different if you don't have statistics, you have outdated/wrong statistics or deliberately still use the RBO (rule based optimizer). In this case you would have to use other means to prevent the index usage, the most obvious would be the already mentioned NO_INDEX or FULL hint.
    But I strongly recommend to check in first place why the optimizer apparently seems to choose an inappropriate index access path.
    Regards,
    Randolf
    Oracle related stuff:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle:
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Error while connecting to Oracle db using jdbc

    When I try to execute a java class which has to access data in
    the Oracle db using Jdbc connection, get an error --
    Appln- pathname/filename is attempting to call the OCI function
    (opinit) this function does not exist in ORA72.DLL.
    Exit this appln ? Yes or No
    Both oracle db & java are on the same PC.Would like to know what
    can be done to rectify this.
    Thanks.
    null

    The OCI driver 7.3 requires the 7.3 OCI to be installed (this is
    part of the client required support files or RSF). The particular
    call in question wasn't added to the OCI untill 7.3 so it
    wouldn't exist in the 7.2 OCI library.
    null

  • How to access Acrobat Plugin using GetInterface?

    Hi
    I'm trying to access a C++ plug-in written for Adobe Acrobat from a C# program. Following is my code, which I found elsewhere in this forum (LINK).
    Type acroApp;
    acroApp = Type.GetTypeFromProgID("AcroExch.App");
    object oAcroObject = Activator.CreateInstance(acroApp);
    object[] param = new object[1];
    param[0] = "MyPlugin";
    object pluginRef = oAcroObject.GetType().InvokeMember("GetInterface",BindingFlags.Invoke Method, null, oAcroObject, param);
    Here, MyPlugin is the name of the plugin (without extension) which I've placed in the Acrobat plug-ins folder. But this way, InvokeMember returns a NULL object instead of the expected interface of my plugin.
    What am I doing wrong? Any help would be greatly appreciated.

    You don't do it that way.
    You need to use standard "inter application communication" methods such as (but not limited to): COM, DDE, shared memory, shared files, named pipes, etc.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Wed, 1 Feb 2012 20:20:23 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: How to access Acrobat Plugin using GetInterface?
    How to access Acrobat Plugin using GetInterface?
    created by Sachintha81<http://forums.adobe.com/people/Sachintha81> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4180327#4180327

  • How to access Oracle Apps 11i forms from Virtual Machine(Vmware Player)?

    Hi,
    I have installed Oracle Apps 11i on native OS OEL5 Server and Windows XPP on Virtual Machine using Vmware Player on standalone same desktop.Now how to access Oracle Apps 11i from Virtual Machine(Windows XPP)?
    Thank's
    Regard's
    Rerry

    Hi,
    Sorry my instance is PROD instead of TEST.
    1)Renamed the sqlnet.ora and make the following change in the tnsnames.ora (SERVICE_NAME = PROD) to (SID = PROD) and tryed but same error.
    2)Only one oracle homes on the cleint machine
    3)The output of tnsping PROD
    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    C:\Documents and Settings\Administrator>tnsping PROD 5
    TNS Ping Utility for 32-bit Windows: Version 8.1.7.0.0 - Production on 23-FEB-20
    10 00:38:40
    (c) Copyright 1997 Oracle Corporation. All rights reserved.
    Attempting to contact (ADDRESS=(PROTOCOL=tcp)(HOST=SHUBH.hnp.com)(PORT=1521))
    TNS-12570: TNS:packet reader failure
    Normal ping is ok from both host to guest and guest to host.
    Thank's
    Regard's
    Rerry

  • How to access remote database using applet

    hi all,
    I want to know how to access remote database using applet,
    Please help me anybody.
    Regards
    Jesu

    If the database is on a public server, you probably can't access it directly (security wise). You can make your applet talk to a server-side application, which makes the database calls on behalf of the applet. But even in an intranet environment this setup is often preferable, because you don't need to distribute a JDBC driver to all your clients.

  • How to access xml file using c

    how to access xml file using c. are there any libraries regarding xml fastinfoset in c? Please let me know about any resources if u know? thanks!!!
    samitha

    There are different methods to access XML data which have pro's and cons. Let us know more about what you want to do and we can help you.

  • How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    Hi,
    Thanks for the suggestion. I've been playing around with some of the classes of the java.net package and java.io
    Using the URL class i can get the content of the data from a STATIC page and output that response to file so that is does not display to the client broswer.
    But this only works if the URL i give points to a static html page.
    So the problem i'm getting is if i'm righting in arguments in the URL, this means that server needs to process the arguments i give and its sends back a dynamic result. Because its dynamic the URL class can not handle this and throws me an exception everytime :(
    Have u ever tried to do some things like this?
    Rahul

  • NCHAR issue with oracle database using JDBC adapter

    Hi,
    We have a requirement to develop an XI interface from FTP server(File adapter) to oracle database using JDBC adapter. In the oracle database table few fields are of type NCHAR/NVARCHAR. when we try to insert the character(A,B,c..) values into oracle table fields of type NCHAR/NVARCHAR, we are getting the following error message in the JDBC adapter audit log. IF we pass the numeric value to the same field, then we are able to insert the records successfully.
    Unable to execute statement for table or stored procedure. 'IPCSDD_DOWNLOAD_PROCESS' (Structure 'StatementName1') due to java.sql.SQLException: ORA-00904: "P": invalid identifier
    2010-10-19 22:29:59 Error JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
    2010-10-19 22:29:59 Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
    Please find the system information below.
    Oracle version- 10.2.4
    XI version - 3.0/ service pack 19
    JDBC driver- oracle.jdbc.driver.OracleDriver
    Please suggest.
    Thanks,
    Venkata
    Edited by: Venkata Narayana  Eepuri on Oct 21, 2010 12:10 AM

    Dear Venkata Narayana,
    Concerning the error, kindly go through the following note :
    731 - Collective note: ORA-00904
    follow the recommendations mentioned in that and please check if that helps.
    Best Regards
    Nishwanth

  • How to connect oracle database using jsf

    how to connect oracle database using javaserver faces with connection pooling

    Here is one way...
    http://jakarta.apache.org/commons/dbcp/

Maybe you are looking for

  • Quicktime plugin for screen capture does not work in flash player 11.2

    Hello,                I have created a quicktime plugin (it is .component file) for screen sharing purpose. I have used quicktime framework for that. plugin is detected in flash player. This plugin is working perfectly for flash player 11 and below.B

  • Is there a way two start a new thread from a BLS to do some background work

    Hi all- I am thinking about creative ways to do offline processing...  Our MII app loads a list of current orders for the user's browser.  The user selects an order and requests back to MII for running the SAP transactions.  Then their browser is rel

  • Any support for papi in bpm 11g ?

    Hi, Request you to please let me know if there is any equivalent support to PAPI ( Process API in 10 g ) available in BPM 11g ? thanks

  • Build detection problem when updating 1.4.2_04 to 1.4.2_06 or higher

    When using the object tag in internet explorer to deploy Java we have a problem updating between builds example: updating Java from 1.4.2_04 to 1.4.2_06 it seems that the object version attribute only checks 1.4.2 and not the build number, so our cli

  • Aperture 3 and iPhoto web galleries...

    Hi Folks, I have used iPhoto and want to shift to Aperture 3. I have the 30day trial installed and have imported my iPhoto library successfully. iPhoto events, photos and albums are shown in Aperture Projects but I cannot see MobileMe or Facebook alb