How to use Oracle Procedures with Servlet page

Hi all
I'm working on Servlet pages and I need to insert and select some records from Oracle database but it has to be done by calling some already written Procedures. I've never really used them before so I'm little lost. I know where the queries are used it'll be Procedures but what is the syntax for it.Can anyone put me in right direction please.
Thanks

Just google it. You will find lots of examples. Here are some :
[http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html|http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html]
[http://onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html|http://onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html]

Similar Messages

  • How to use Oracle partitioning with JPA @OneToOne reference?

    Hi!
    A little bit late in the project we have realized that we need to use Oracle partitioning both for performance and admin of the data. (Partitioning by range (month) and after a year we will move the oldest month of data to an archive db)
    We have an object model with an main/root entity "Trans" with @OneToMany and @OneToOne relationships.
    How do we use Oracle partitioning on the @OneToOne relationships?
    (We'd rather not change the model as we already have millions of rows in the db.)
    On the main entity "Trans" we use: partition by range (month) on a date column.
    And on all @OneToMany we use: partition by reference (as they have a primary-foreign key relationship).
    But for the @OneToOne key for the referenced object, the key is placed in the main/source object as the example below:
    @Entity
    public class Employee {
    @Id
    @Column(name="EMP_ID")
    private long id;
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ADDRESS_ID")
    private Address address;
    EMPLOYEE (table)
    EMP_ID FIRSTNAME LASTNAME SALARY ADDRESS_ID
    1 Bob Way 50000 6
    2 Sarah Smith 60000 7
    ADDRESS (table)
    ADDRESS_ID STREET CITY PROVINCE COUNTRY P_CODE
    6 17 Bank St Ottawa ON Canada K2H7Z5
    7 22 Main St Toronto ON Canada     L5H2D5
    From the Oracle documentation: "Reference partitioning allows the partitioning of two tables related to one another by referential constraints. The partitioning key is resolved through an existing parent-child relationship, enforced by enabled and active primary key and foreign key constraints."
    How can we use "partition by reference" on @OneToOne relationsships or are there other solutions?
    Thanks for any advice.
    /Mats

    Crospost! How to use Oracle partitioning with JPA @OneToOne reference?

  • How to Use Oracle 8i with MapX?

    I am trying to work with oracle 8i 1.6 and mapX 4.5 but un-able to do so. I tried by adding server layer but couldn't do so.
    Help !!

    Crossposted: Re: How to use Oracle partitioning with JPA @OneToOne reference?

  • How to use stored procedure with many return results and variable with perl

    Hi everybody,
    i´m writtting now a Perl programm, wich use a oracle stored procedure with more than 1 result and 1 variable(I have to return 2 variable fpr each result). I don´t now how I can get it.I already search the web but I didn´t find.
    My example:
    PROCEDURE get_projects_and_sub_projects (
    v_project_id IN INTEGER,
    v_project_c_id OUT INTEGER,
    v_project_id_find OUT VARCHAR2
    IS
    BEGIN
    SELECT c_id, proj_id
    INTO
    v_project_c_id,
    v_project_id_find
    FROM t_projet
    WHERE t_projet .ksa_pro_art_kbz = 'KU'
    AND t_projet.proj_id LIKE v_project_id || '%';
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    v_project_c_id := NULL;
    v_project_id_find := NULL;
    WHEN OTHERS
    THEN
    kmessages.error (NULL,
    'get_projects_and_sub_projects',
    'Project-Name: ' || v_project_id,
    'Errornumber: '
    || SQLCODE
    || ' Error: '
    || SQLERRM,
    TRUE,
    TRUE
    raise_application_error (-20001,
    'Error '
    || SQLCODE
    || ' get_projects_and_sub_projects: '
    || SQLERRM,
    TRUE
    END get_projects_and_sub_projects;
    in Perl Program:
    sub get_projects_unterprojects_name($$){
    my ($db_handle, $proj_name_id) = @_; #$db_handle ist the DB Connection return value
    my $db_proj_c_id;
    my $db_proj_name;
    eval{ my $csr = $db_handle->prepare(q{
    BEGIN
    pro_doc_ber.get_projects_and_sub_projects(:proj_name_id, :db_proj_c_id, :db_proj_name);
    END;
    # parameter value
    $csr->bind_param(":proj_name_id", $proj_name_id);
    # return values
    $csr->bind_param_inout(":db_proj_c_id", \$db_proj_c_id, 11);
    $csr->bind_param_inout(":db_proj_name", \$db_proj_name, 20);
    $csr->execute(); };
    But this didn´t work. Could somebody give me some idea?
    Thank you
    Felx

    Some additional info would probably be helpful.
    What is your programming enviironment? Java?
    In any case I suspect that you will need to use the OCI to deal with specific Oracle types such as user defined object types -- thats not standard ANSI SQL.
    In Java I believe you need to use OPAQUE, there are some examples out there. I'm mostly a PL/SQL developer with some Java expereince so others here are more qualifed to answer your question more directly.

  • How to use TeleCheck service with coldfusion page

    hi,
    I m new to coldfusion want to use TeleCheck service on
    coldfusion page.
    can any one provide me technical support in this regards with
    thanks
    Shane

    Just google it. You will find lots of examples. Here are some :
    [http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html|http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html]
    [http://onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html|http://onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html]

  • How to use Oracle APEX with Oracle12c - Beginner

    Hi. I have been using for months Oracle Application Express thanks to the online workspace on https://apex.oracle.com/i/index.html.
    Now, I want to create my production environment. I have installed Oracle Database 12c on a virtual machine (Oracle Virtual Box) based on Windows Server 2008 R2 (64 bit) o.s.
    I have created a new database and, during this process, I have selected only "Oracle Application Express" as database's option. Now, I don't know how to use APEX, how to configure the Listener and whatever I need to let the users may use my APEX's applications. Thank you very much for any help. Please consider that I am a beginner and I don't know how to master the administrative-side of APEX.
    Saverio

    Hi Neruda from Italy,
    Neruda from Italy wrote:
    Thank you very much. Anyway, If I installed Oracle11g then the list of instructions to follow in order to configure Oracle Apex is the following?
    Installing and Configuring Oracle Application Express and BI Publisher in Oracle Database 11g Release 2
         By Oracle 11g, do you mean Oracle Database 11g Express Edition?
         The list of instructions are correct in a way but the OBE is somewhat old (Instead you should always go for Oracle Documentation).
         Following are the installation guides for APEX versions:
    APEX 5.0 - https://docs.oracle.com/cd/E59726_01/install.50/e39144/toc.htm
    APEX 4.2 - http://docs.oracle.com/cd/E37097_01/install.42/e35123/toc.htm
         As you are going for configuring Embedded PL/SQL Gateway (as given in the OBE above) here are the detailed steps to install APEX and configure EPG:
    APEX 5.0 - https://docs.oracle.com/cd/E59726_01/install.50/e39144/epg.htm#HTMIG386 (skip the steps for Oracle Database 12c)
    APEX 4.2 - http://docs.oracle.com/cd/E37097_01/install.42/e35123/otn_install.htm#HTMIG389
         If you deem that your question is answered, then please close the thread by marking the appropriate replies helpful/correct.
    Regards,
    Kiran

  • How to use Stored Procedures with SQLServer2005 and WAS 6.x

    Hi All
    I've got a problem, during the call to a StoredProcedure in SQLServer i've get the next message:
        Exception : com.microsoft.sqlserver.jdbc.SQLServerException: Fetch size cannot be negative
    The stored procedure is working correctly if I run my process out of WAS 6.x but if I get a connection from the pool the process don't work.
    Help please, thanks.

    Your procedure has a single OUT parameter ... and yet it appears you are trying to stuff something into it ... that is never going to work. Additionally everything else about your stored procedure would have gotten you a FAIL grade were you been in my beginning PL/SQL class.
    The syntax, a cursor loop, is obsolete and has been for more than 10 years.
    The formatting and use of case makes even the few lines written hard to read.
    And either no commit ever takes place or you are trying to do incremental commits in origseq: Both of which are bad practice.
    This code should use BULK COLLECT to collect all relevant records into an array and then pass the array to origseq ... no loops ... and end with a commit.
    Demo here: http://www.morganslibrary.org/reference/array_processing.html

  • How to use oracle APEX with an distant database located on a distant server

    Hi there,
    I'm a brand new user with Oracle Technologies. I've installed ORACLE 10g XE and updated APEX to 4.0 version on my laptop.
    My Manager has setup a distant server with a Linux Red Hat. He has installed on this server EBS R12 with a 11i database.
    As a training, I'd like to play with the tables located on the server with the APEX 4.0 installed on my laptop.
    As the server is on the same local network and following the description above, is it possible to plug my local APEX to the server database ?
    If not, does it mean I have to install APEX on the 11i server database and then connect to the server to play with those tables ?
    Thanks a lot for your time and support ACEs members.
    Regards,
    Ulrich

    Hi Ulrich,
    yes, you can access other database from your APEX database. The mechanism used to do this is called a "database link". You need to create such a database link in your local database, then you can access the remote database like this:
    SELECT *
      FROM databaselink@EMP
    ;If you want to use such remote objects from within APEX you need to create local views to wrap this (search the forum for apex and database links, you'll find interesting threads).
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    BuilderPlugin: http://builderplugin.oracleapex.info
    Work: http://www.click-click.at

  • How to use EAServer Jaguar with servlets?

    I have a web application that I have done using Tomcat and now need to run it with EAServers Jaguar. I am currently going through EAServer 5.2 documentation and the tutorial for creating a simple java application seems rather tedious ( have to use EAServers manager to create packages and components etc).
    Can anyone out there with experience tell me if going through the entire EAServer documentation will help me configure the server for servlets n jsp or is there an easier way to do things? Is it possible for me to just export my whole Web Application folder to some location in EAServer directories and run it like we do in Tomcat?
    I cant seem to find much help or tutorials on the net... Thanks for any help!!

    Ive found a few sources that uses PowerJ IDE to create WAR files to deploy in EAServers Manager. I tried creating a HelloWorld WAR without any IDE but cant seem to deploy it in EAServer Manager.
    Can anyone give some advice??

  • How to use oracle crypto with RSA

    Hi,
    I found oracle crypto and we will use it http://download-uk.oracle.com/docs/cd/B25221_04/security.1013/b25372/crypto.htm#BJFIHJFH
    but it generates an errors:
    SQL> CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "NetsafeCrypt" AS
    2 import java.lang.*;
    3 import java.io.*;
    4 import oracle.security.crypto.core.*;
    5 import oracle.security.crypto.util.*;
    6
    7 public class NetsafeCrypt {
    8 public static String RSAEncrypt(String data, String pubKeyData) {
    9 RSAPublicKey pubKey = RSAPublicKey(pubKeyData.getBytes());
    10 return "abc";
    11 }
    12 };
    13 /
    Warning: Java created with compilation errors.
    SQL> show error
    Errors for JAVA SOURCE "NetsafeCrypt":
    LINE/COL ERROR
    0/0 NetsafeCrypt:8: cannot find symbol
    0/0 symbol : class RSAPublicKey
    0/0 location: class NetsafeCrypt
    0/0 RSAPublicKey pubKey = RSAPublicKey(pubKeyData.getBytes());
    0/0 ^
    0/0 2 errors
    0/0 symbol : method RSAPublicKey(byte[])
    0/0 location: class NetsafeCrypt
    0/0 RSAPublicKey pubKey = RSAPublicKey(pubKeyData.getBytes());
    0/0 ^
    0/0 NetsafeCrypt:8: cannot find symbol
    My CLASSPATH is ok.
    echo $CLASSPATH
    /opt/app/oracle/product/11/db_1/JRE:/opt/app/oracle/product/11/db_1/jlib:/opt/app/oracle/product/11/db_1/rdbms/jlib:/opt/app/oracle/product/11/db_1/network/jlib:/opt/app/oracle/product/11/db_1/jlib/osdt_core.jar
    Regards,
    Tom

    oracle.crypto is not supported in the 10.1.x release of the oracle JVM/Database. We do support the Sun JCE encryption API's as documented by Sun. I recommend using the JCE and JSSE API's as they are the standard moving forward with later releases of Oracle.
    Setting of the client CLASSPATH has no effect on classes loaded into the database. The resolution model is explained in the Oracle Database Java Developers Guide.

  • How to use oracle Portal with JDeveloper 10.1.3 ADF JSF

    Hi all
    I use JDeveloper 10.1.3
    I found out that the latest Portal 10.1.4 does not support JSF ADF
    IF I WANT USE PORTAL ,WHAT SHALL I DO?
    Thanks

    OracleAS Portal 10.1.4 does not support JSF portlets.
    JSF support in OracleAS Portal is in development.

  • Using stored procedures with a timestamp parameter with Delphi  and ADO

    Dear Oracle experts,
    I have a problem concerning using a stored procedure with Delphi.
    I try to use a stored procedure which hast two input parameters ( a integer and a timestamp).
    The timestamp parameter is my problem since I would like to use the "to_timestamp"
    Oracle-function to create the timestamp parameter to be inserted into my procedure.
    If I insert the to_timestamp statement as a adodatetime I have to perform the conversion to the oracle timestamp in my application.
    If I want to use the to_timestamp statement I have to use the ftstring datatype but in that case I get an error because I use a string as input for my procedure were it awaits a timestamp.
    So the problem seems to be that the function call "to_timestamp" is not interpreted if it is transferred through my ADO component.
    Do you know how to use a procedure with Delphi (ADO) with a function as input parameter ?
    Best regards,
    Daniel Wetzler
    P.S. :
    This is the Delphi code to use my Procedure.
    FactsTempDS:=TADODataset.Create(nil);
    Sproc1 := TAdoStoredProc.Create(nil);
    Sproc1.Connection := TDBConnection(strlistConnectionstrings.objects[iConnectionIndex]).Connection;
    Sproc1.ProcedureName := 'ECSPACKAGE.PROCFINDINITIALSWITCHSTATE';
    Sproc1.Parameters.CreateParameter ('SwitchID',ftInteger,pdinput,0,0);
    //Sproc1.Parameters.CreateParameter ('StartTime',ftdatetime,pdinput,50,0);
    Sproc1.Parameters.CreateParameter ('StartTime',ftString,pdinput,50,0);
    Sproc1.Parameters.Findparam('SwitchID').value:=SwitchID;
    Sproc1.Parameters.FindParam('StartTime').Value:= 'to_timestamp(''2005/12/30 19:36:21'', ''YYYY/MM/DD HH:MI:SS'')';
    Sproc1.CursorType := ctKeyset;
    Sproc1.ExecuteOptions:=[];
    Sproc1.Open;
    Sproc1.Connection := nil;
    FactsTempDS.Recordset:= sproc1.Recordset;
    if FactsTempDS.RecordCount=0
    then raise Exception.Create('No line switch variable found for switch '+IntToStr(SwitchID)+' before starttime. Check BDE dump filter.')

    I have my entity manager setup in a singleton.
    I'm finding it's costly to generate the emf, but if I don't close the em (enitity manager) and emf (entity manager factory) my open cursor count climbs until I exceed the max number of open cursors on the database (11g RAC)
    I'm committing the connection, and uow, and closing the em at the end of each call.
    But until I close the emf, the open cursors aren't released.
    TransactionhistoryPkg tranPkg = new TransactionhistoryPkg(conn); //Class created over database package via JPublisher
    tranPkg.transactionhistoryInsSp(insertTrans.getCardId()); // executes db package
    tranPkg.closeConnection();
    conn.commit();
    uow.commit();
    uow.getAccessor().decrementCallCount();
    em.close();
    Am I missing something really obvious here??
    btw - I found this link helpful in troubleshooting the max cursors issue: https://support.bea.com/application_content/product_portlets/support_patterns/wls/InvestigatingORA-1000MaximumOpenCursorsExceededPattern.html

  • How to  use  Stylesheet (XSL) with JSPX ?

    Hi!
    How to use XSL stylesheets with JSPX pages?
    I want use an xsl transformations with jspx pages, I tried using the following syntax, but it didn't work....
    <?xml version='1.0' stylesheet type="text/xsl" href="mathml.xsl" encoding='UTF-8'?>
    <tr:html xmlns="http://www.w3.org/1999/xhtml">
    what is the best way to use xslt with jspx pages?
    Thanking you in advance,
    Samba

    Thanks Ric,
    But My problem is not solved..
    I'm getting the transformation working in plain HTML
    The file given below :
    <?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
    <!--
    Copyright David Carlisle 2001, 2002.
    Use and distribution of this code are permitted under the terms of the <a
    href="http://www.w3.org/Consortium/Legal/copyright-software-19980720"
    W3C Software Notice and License</a>.-->
    <html xmlns="http://www.w3.org/1999/xhtml"
    >
    <head>
    <title>Content MathML Examples</title>
    </head>
    <body>
    <div style="border-style:solid; border-width:1px; margin: 1em 1em 1em 1em; padding: 1em 1em 1em 1em;color:gold;background:grey;">
    <pre><![CDATA[<math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
    <eq/>
    <apply>
      <abs/>
      <ci> x </ci>
    </apply>
    <piecewise>
      <piece>
          <apply><minus/><ci> x </ci></apply>
          <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <cn> 0 </cn>
          <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <ci> x </ci>
          <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
    </piecewise>
    </apply>
    </math>]]>
    </pre>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
    <eq/>
    <apply>
      <abs/>
      <ci> x </ci>
    </apply>
    <piecewise>
      <piece>
          <apply><minus/><ci> x </ci></apply>
          <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <cn> 0 </cn>
          <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <ci> x </ci>
          <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
    </piecewise>
    </apply>
    </math>
    </div>
    </body>
    </html>But the same thing is not working when put in jspx page..
    And I tried to use JSTL as you have suggested :
    But the content is not getting transformed.
    Here is the jspx page :
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:c="http://java.sun.com/jsp/jstl/core"
              xmlns:x="http://java.sun.com/jsp/jstl/xml"
              xmlns:m="http://www.w3.org/1998/Math/MathML"
              xmlns:xh="http://www.w3.org/1999/xhtml">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document binding="#{backing_xsltTest.document1}" id="document1">
    <div style="border-style:solid; border-width:1px; margin: 1em 1em 1em 1em; padding: 1em 1em 1em 1em;color:gold;background:grey;">
    <f:verbatim>
    <pre><![CDATA[<math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
    <eq/>
    <apply>
      <abs/>
      <ci> x </ci>
    </apply>
    <piecewise>
      <piece>
          <apply><minus/><ci> x </ci></apply>
          <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <cn> 0 </cn>
          <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <ci> x </ci>
          <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
    </piecewise>
    </apply>
    </math>]]>
    </pre>
    </f:verbatim>
    <c:import var ="mathml" url="/mathml.xsl"/>
    <x:transform  xslt="${mathml}">
    <math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
    <eq/>
    <apply>
      <abs/>
      <ci> x </ci>
    </apply>
    <piecewise>
      <piece>
          <apply><minus/><ci> x </ci></apply>
          <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <cn> 0 </cn>
          <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <ci> x </ci>
          <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
    </piecewise>
    </apply>
    </math>
    </x:transform>
    </div>
          <af:form binding="#{backing_xsltTest.form1}" id="form1">
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_xsltTest-->
    </jsp:root>Can you please suggest where I'm doing wrong?
    Thanking you in advance,
    Samba

  • Use Oracle Reports with Jdeveloper 11

    Hi,
    My next question. How to use Oracle Reports with jdeveloper 11. I have more oracle reports (used with a existing forms application) and i need to migrate this application to web-adf application. I think that is very powerful to use this oracle definition reports but i not know ho to do it.
    thanks,
    Jordi

    Read the publishing reports manual of Oracle reports to see how to Web enabled your Oracle reports. You can then invoke them from an ADF application either by calling a URL or using a Web service interface.

  • How can i import procedure with %ROWTYPE in Oracle 10.2 (paris) warehouse b

    Hello.
    How can i import procedure with %ROWTYPE in Oracle 10.2 (paris) warehouse builder?Everytime i try to do it i get an error message:
    API0411: Name should be an empty string.
    If i comment out %rowtype i can import it without problems.
    I have tried re-creating the procedure in OWB but once again i cannot find the %rowtype anywhere. the %type is there etc. I have tried to use Publish transformation / custom and cannot find %rowtypa there either.
    Thank you very much for your help

    Just in case you are having the same problem and cannot find any help anywhere - it is a bug in OWB.
    I got in touch with Oracle Support and it appears that it is possible to import procedure/package with %ROWTYPE inside it, but it is not possible if the %ROWTYPE is in the arguments.
    Just waiting for them to provide me with the bug ID.

Maybe you are looking for