Enum in java 5 to be replaced in java2

Hi,
Could anyone suggest for the following problem
Now in a lot of programs, enum keyword is used which use java5 and this keyword is to be replaced by some codes which would run with java2 .
Could anyone please say a generic way by which i will not need to change in each file and solve the purpose which can be run by java2 too.

: /\ P:^P would look better. ;)
0 0
  >
  U

Similar Messages

  • Implement enum in java

    I need help in implementing enums in java.
    I am using java 1.4.2
    I want to implement enum inside my public class.
    Any pointers....
    Thanks
    Cheers

    thanks for the responses...
    dont have much control over java version...achieved
    this using static final int
    thanks
    cheersI strongly recommend you buy this book. Not only does it tell you how to implement typesafe enums, it's chock-full of very useful tips and the like, that if you pay attention to will make you a better programmer

  • Possible to extend java Concurrent Program and replace standard??

    Hi All!
    i have following developing need. There is a java concurrent program POXPOPDF (PO Output for Communication). The customer needs this program to do actually something complete different than printing the PO in PDF. The executable for this CP is java class PoGenerateDocumentCP in oracle.apps.po.communicate package.
    We thought that we may be able to extend that class and then in some way made OA to use the extended java class instead of the standard. This is possbile and simple for OA Framework pages unsing classes as controllers, but I don't know how it could be done for CP (if there's a way to do it without violent intervention in standard system).. Is it possbile, can anyone help me with this.
    The thing is that instead of reformatting the XML returned from PO_COMMUNICATION_PVT.POXMLGEN (function POXMLGEN in database package PO_COMMUNICATION_PVT) into PDF we want to reformat into another XML and then send it in other way to a webservice. Once I have the XML from POXMLGEN I have no problem to reformat it into another XML (I think, I have done it iwith other issues/processes). The webservice and the call to it is no problem and is already use with other purposes in other processes, but here (replaceing this stadard java class for an extension/new one) I am a little lost.
    Appreciate very much your help.
    Regards,
    Patricia

    Never mind, I see now that FND_REQUEST.SUBMIT_REQUEST() really does work, I tried with a different standard java concurrent program and it worked fine, and then I figured out that my parameters into fnd_request.submit_request for concurrent program APXVVCF4 were not correct (application short name was invalid for concurrent program).
    Thanks for the Info!

  • Java regex - eval for replacement

    Hi
    Could you please help me in a regex problem?
    I have a regex pattern in a string. I want to apply this on a text, and wherever it is applied the matched text should be replaced by the length of the found text. Now I have done it with a while loop, but it takes too long to process:
                   Pattern p = Pattern.compile(patternString);
                   Matcher m = p.matcher(text);
                   // I dont know how to get this job done with m.replaceAll(). Thats why the following loop
                   // By the way, in Perl there is "eval" with which we can do this
                   while (m.find()) {
                        String foundText = m.group();
                        Pattern p2 =  Pattern.compile( Pattern.quote(foundText) );
                        text = p2.matcher(text).replaceAll( foundText.length() );
                   }Is there a better way? Kindly help.
    Thanks
    Sri

    There's nothing like Perl's /e modifier (or Ruby's gsub) in Java's regex support, but ther's a much better alternative to what you're doing. In addition to replaceAll() and replaceFirst(), Matcher provides the lower-level methods appendReplacement() and appendTail() that offer you more control over the replacement process. Check this out: Pattern p = Pattern.compile(patternString);
    Matcher m = p.matcher(text);
    StringBuffer sb = new StringBuffer();
    while (m.find()) {
      m.appendReplacement(sb, String.valueOf(m.group().length()));
    m.appendTail(sb);
    text = sb.toString(); Or you could just use Elliott Hughes' Rewriter class. (You may need to get rid of some code in the main() method that references other utility classes of his; Rewriter itself only depends the java.util.regex package.)

  • Enum - core java II example

    hi
    the following code is an example taken from 'core java II'-book.
    what i don't understand is where the enum constructor is called
    to set the abbreviation field
    anyone care to explain ?
    thanks
    import java.util.*;
    public class EnumTest {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            System.out.print("Enter a size: (SMALL, MEDIUM, LARGE, EXTRA_LARGE) ");
            String input = in.next().toUpperCase();
            Size size = Enum.valueOf(Size.class, input);
            System.out.println("size=" + size);
            System.out.println("abbreviation=" + size.getAbbreviation());
            if (size == Size.EXTRA_LARGE) {
                System.out.println("Good job--you paid attention to the _.");
    enum Size {
        SMALL("S"), MEDIUM("M"), LARGE("L"), EXTRA_LARGE("XL");
        private Size(String abbreviation) {
            this.abbreviation = abbreviation;
        public String getAbbreviation() {
            return abbreviation;
        private String abbreviation;
    }

    so from what i get here is that
    SMALL("S"),MEDIUM("M"),LARGE("L"); are the constructors from where abbreviations are taken.
    I want to clear one more doubt.
    private Size(String abbreviation) {
            this.abbreviation = abbreviation;1. This is also a constructor right ? If yes then, what was the need that the author made this constructor private ?
    2. Why public modifier is not allowed there ?
    3. Size s = Enum.valueOf(Size.class,input);Over here what is the role of argument Size.class ?
    4. enum size
    Size s = Enum.valueOf(Size.class,input);In the first code enum's e is small but in the second code Enum's E is capital. How so ?
    Edited by: levislover on Jun 16, 2010 11:29 PM

  • Java.util.regex and replacing patterns with function calls

    Hi everyone,
    I'm in terrible need for help.
    Any advice is much appreciated.
    I have the following sentence in a file. The sequence of numbers is actually a
    date in seconds since 1970. I need to identify the 9 or 10 sequence of numbers
    send that to a method that will transate the numbers into a date in a string format.
    Then replace it in the file.
    Here is an example:
    "My name is Peter. Please 1020421277 help me figure this out 108062327. "
    using the following block I can convert it to this
    "My name is Peter. Please | help me figure this out |. "
    [block]
    Pattern p = Pattern.compile("[0-9]{9,10}+");
    Matcher m = p.matcher("");
    String aLine = null;
    while((aLine = in.readLine()) != null) {
    m.reset(aLine);
    String result = m.replaceAll("|");
    out.write(result);
    out.newLine();
    [end block]
    So I need to change the above block so that my sentence looks like this.
    "My name is Peter. Please 05/03/2002 10:21:17 help me figure this out 06/04/1973 17:18:47. "
    The method that converts the numbers into a date is not of a concern because I already have
    the code to do that.
    If anyone has suggestion, please let me know.
    Thanks in advance.
    Peter
    [email protected]

    Never mind, I was able to figure it out....
    Common2 cm = new Common2();
    Pattern p = Pattern.compile("[0-9]{9,10}+");
    Matcher m = p.matcher("");
    m = p.matcher(s1);
    while ((found = m.find())) {
    String replaceStr = m.group();
    System.out.print("\tReplaceString is: " + replaceStr);
    replaceStr = cm.get_date(replaceStr);
    System.out.println("\t\tConverted to: " + replaceStr);
    m.appendReplacement(buf,replaceStr);
    m.appendTail(buf);
    ----------------- The get_date method in Common2 looked like this ------------------------------
    public String get_date(String myString)
    String s;
    long lsecs = Long.parseLong(myString);
    lsecs = lsecs * 1000; // its now milliseconds.
    // Determine default calendar and then the offset to GMT.
    Calendar localCalendar = Calendar.getInstance();
    int offset = localCalendar.get(Calendar.DST_OFFSET) + localCalendar.get
    (Calendar.ZONE_OFFSET);
    // Take the number of milliseconds subtract the gmtoffset
    Date GMTdate = new Date(lsecs - offset);
    // Format date
    Format myformat;
    myformat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss a z ");
    s = myformat.format(GMTdate);
    return s;
    Peter

  • HT202912 How do I remove Java 1.7 and replace this with Java 1.6.0_65?

    I need to get back to  an older JRE specifically Java 1.6.0_65. Right now I have Java 1.7.-_71-b14.
    I've tried the instruction in the terminal - sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
    That doesn't work. In Terminal mode, a "java -version" query returns the same "Java 1.7..." indicating it has not been removed. What else do I have to do here ?
    Thanks

    I need to get back to  an older JRE specifically Java 1.6.0_65. Right now I have Java 1.7.-_71-b14.
    I've tried the instruction in the terminal - sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
    That doesn't work. In Terminal mode, a "java -version" query returns the same "Java 1.7..." indicating it has not been removed. What else do I have to do here ?
    Thanks

  • JAVA Sax mapping replaces &_amp; with & causing mapping to fail

    Hi all,
    I have the following mapping scenario:
    Source XML -> Java Sax Mapping -> Graphical Mapping -> Target structure
    The source XML is valid and caters for special characters like & which appear as &_amp; in the XML (ignore the underscore _ without it the editor strips the amp;, isn't that ironic!).
    The second step of the interface mapping, which is the graphical map, is failing. It seems that the Java Sax mapping is replacing &_amp; with & in the XML, which is then causing the graphical map to fail as it cannot handle the special character &.
    Is there anyway I can prevent the Java Sax mapping from changing & to &
    Or is the only solution for me to write extra code in the Java map to convert & back to &_amp; before passing to the second mapping step????
    Any help appreciated.
    Che
    Edited by: Che Eky on Feb 18, 2009 11:05 PM

    Hi..
    Use this in your source xml file for '&' ->"&_amp;" remove the underscore
    Regards..
    Krishna..
    Edited by: PrasannaKrishna Mynam on Feb 19, 2009 2:20 PM
    Edited by: PrasannaKrishna Mynam on Feb 19, 2009 2:20 PM

  • How to avaoid java.lang.IllegalArgumentException: No enum const class

    HI ,
    Iam getting java.lang.IllegalArgumentException when iam using switch case through Enum contants.
    //Enum Constants declaration
    public enum USEOFPROCEEDSVALUES { U1,U2,U3, U4}
    //Using Enum in Java class
    Test.java
    USEOFPROCEEDSVALUES useOfProceedsVar =USEOFPROCEEDSVALUES.valueOf(useOfproceeds);
    switch (useOfProceedsVar) {   
                   case U1:
                   revenueSourceCode="REVENUE_SOURCE_CODE.POWER";
                        break;
                   case U2:
                        revenueSourceCode="REVENUE _SOURCE_CODE.WATER";
                   break;
                   case U3:
                        revenueSourceCode="REVENUE_SOURCE_CODE.POWER";
                        break;
                   case U4:
                             revenueSourceCode=REVENUE_SOURCE_CODE.POWER";
                        break;
    default:
                        revenueSourceCode=null;
    Exception raising if there is either of these not U1,U2,U3,U4 ara not avalabele. i.e is if useOfProceedsVar is A6 then exception raising
    How to avoid this exception
    Thanks for early reply

    user818909 wrote:
    HI ,
    Iam getting java.lang.IllegalArgumentException when iam using switch case through Enum contants.
    //Enum Constants declaration
    public enum USEOFPROCEEDSVALUES { U1,U2,U3, U4}
    //Using Enum in Java class
    Exception raising if there is either of these not U1,U2,U3,U4 ara not avalabele. i.e is if useOfProceedsVar is A6 then exception raisingActually useOfProceedsVar can never be A6, it can only take a value from the enum.
    The exception will be raised by valueOf, which (quite correctly) throws it if the String you pass to it doesn't match any of the enum constants.
    >
    How to avoid this exception
    Don't avoid it, process it. What do you want your code to do if the string doesn't match any of your enum constants? Whatever it is, stick it in a catch clause.

  • POFing Enums... InstantiationException

    I'm getting this exception
    Exception in thread "Thread-1" (Wrapped) java.io.IOException: An exception occurred instantiating a PortableObject user type from a POF stream: type-id=10015, class-name=oms.grid.SendingType, exception=
    java.lang.InstantiationException: oms.grid.SendingType
            at com.tangosol.util.ExternalizableHelper.fromBinary(ExternalizableHelper.java:265)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ConverterFromBinary.convert(PartitionedCache.CDB:4)
            at com.tangosol.util.ConverterCollections$ConverterInvocableMap.invoke(ConverterCollections.java:2281)
            at com.tangosol.util.ConverterCollections$ConverterNamedCache.invoke(ConverterCollections.java:2747)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ViewMap.invoke(PartitionedCache.CDB:11)
            at com.tangosol.coherence.component.util.SafeNamedCache.invoke(SafeNamedCache.CDB:1)
            at coup.QueueReader.run(QueueReader.java:105)
            at java.lang.Thread.run(Thread.java:722)
    Caused by: java.io.IOException: An exception occurred instantiating a PortableObject user type from a POF stream: type-id=10015, class-name=oms.grid.SendingType, exception=java.lang.InstantiationException: oms.grid.SendingType
            at com.tangosol.io.pof.PortableObjectSerializer.deserialize(PortableObjectSerializer.java:122)
            at com.tangosol.io.pof.PofBufferReader.readAsObject(PofBufferReader.java:3306)
            at com.tangosol.io.pof.PofBufferReader.readAsObjectArray(PofBufferReader.java:3350)
            at com.tangosol.io.pof.PofBufferReader.readAsObject(PofBufferReader.java:2924)
            at com.tangosol.io.pof.PofBufferReader.readObject(PofBufferReader.java:2603)
            at com.tangosol.io.pof.ConfigurablePofContext.deserialize(ConfigurablePofContext.java:358)
            at com.tangosol.util.ExternalizableHelper.deserializeInternal(ExternalizableHelper.java:2745)
            at com.tangosol.util.ExternalizableHelper.fromBinary(ExternalizableHelper.java:261)
            ... 7 moremy SendingType.java file looks like
    package oms.grid;
    import com.tangosol.io.pof.PofReader;
    import com.tangosol.io.pof.PofWriter;
    import com.tangosol.io.pof.PortableObject;
    import java.io.IOException;
    public enum SendingType implements PortableObject {
        NEW_ORDER,
        CANCEL,
        REPLACE,
        IGNORE;
        public void readExternal(PofReader reader) throws IOException {
        public void writeExternal(PofWriter writer) throws IOException {
    }probably I'm making this too difficult, right?
    Thanks,
    Andrew

    We just use a generic serializer for all enums:
    public class EnumSerializer implements PofSerializer {
         @SuppressWarnings({ "rawtypes" })
         private final Class<Enum> type;
         private final Object[] enumValues;
         @SuppressWarnings({ "unchecked", "rawtypes" })
         public EnumSerializer(int typeId, Class<Enum> type) {
              try {
                   this.type = type;
                   enumValues = EnumSet.allOf(type).toArray();
              } catch(Throwable t) {
                   t.printStackTrace();
                   throw new RuntimeException(t);
        @Override
        public Object deserialize(PofReader in) throws IOException {
             try {
                  final int ordinal = in.readInt(0);
                  try {
                       return enumValues[ordinal];
                  } catch(ArrayIndexOutOfBoundsException e) {
                       throw new IOException(String.format("An error ocurred trying to deserialize enum [%s]: ordinal %d is not a valid value.", type.getName(), ordinal), e);
            } finally {
                in.readRemainder();
        @SuppressWarnings({ "rawtypes" })
        @Override
        public void serialize(PofWriter out, Object obj) throws IOException {
             Enum e = (Enum) obj;
            out.writeInt(0, e.ordinal());
            out.writeRemainder(null);
    }Regards, Paul

  • PL/SQL w/ Java to run OS batch file crashes Oracle

    I followed instructions from "Ask Tom" on using PL/SQL with Java to execute an OS batch file. For testing purposes, my batch file does nothing more than display the date and time from the OS.
    However, when I run the PL/SQL that executes this simple batch file repeatedly - anywhere from two to four times, the Oracle instance crashes abruptly. Nothing is written to the alert log. No trace files are created.
    Here is a sample session:
    SQL*Plus: Release 9.0.1.3.0 - Production on Wed Mar 24 10:04:26 2004
    (c) Copyright 2001 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> set serveroutput on size 1000000
    SQL> exec dbms_java.set_output(1000000) ;
    PL/SQL procedure successfully completed.
    SQL> begin
    2 rc('c:\dba_tools\jobs\test.cmd') ;
    3 end ;
    4 /
    C:\Ora9ir2\DATABASE>date /t
    Wed 03/24/2004
    C:\Ora9ir2\DATABASE>time /t
    10:05 AM
    PL/SQL procedure successfully completed.
    SQL> begin
    2 rc('c:\dba_tools\jobs\test.cmd') ;
    3 end ;
    4 /
    C:\Ora9ir2\DATABASE>date /t
    Wed 03/24/2004
    C:\Ora9ir2\DATABASE>time /t
    10:06 AM
    PL/SQL procedure successfully completed.
    SQL>
    Shortly after the second "run", Oracle crashed. All I received was the following error message:
    Unhandled exception in oracle.exe (ORAJOX9.DLL): 0xC0000005: Access Violation
    Here is the Java procedure at the heart of my PL/SQL:
    create or replace and compile
    java source named "Util"
    as
    import java.io.*;
    import java.lang.*;
    public class Util extends Object
    public static int RunThis(String args)
    Runtime rt = Runtime.getRuntime();
    int rc = -1;
    try
    Process p = rt.exec(args);
    int bufSize = 4096;
    BufferedInputStream bis =
    new BufferedInputStream(p.getInputStream(), bufSize);
    int len;
    byte buffer[] = new byte[bufSize];
    // Echo back what the program spit out
    while ((len = bis.read(buffer, 0, bufSize)) != -1)
    System.out.write(buffer, 0, len);
    rc = p.waitFor();
    catch (Exception e)
    e.printStackTrace();
    rc = -1;
    finally
    return rc;
    I am running Oracle 9i rel. 2 installed on my PC under Windows XP Professional (Service Pack 2). My knowledge of Java is next to nothing.
    Can anyone give me an idea(s) as to what might be causing Oracle to crash?
    Thanks.

    Using 9.2.0.4 I made the following adjustments and it seems to run as often as I care to do it:
    Java changes:
    create or replace and compile
    java source named "Util"
    as
    import java.io.*;
    import java.lang.*;
    public class Util extends Object
    public static void RunThis(java.lang.String args)
    Runtime rt = Runtime.getRuntime();
    int rc = -1;
    try
    Process p = rt.exec(args);
    int bufSize = 4096;
    BufferedInputStream bis =
    new BufferedInputStream(p.getInputStream(), bufSize)
    int len;
    byte buffer[] = new byte[bufSize];
    // Echo back what the program spit out
    while ((len = bis.read(buffer, 0, bufSize)) != -1)
    System.out.write(buffer, 0, len);
    rc = p.waitFor();
    catch (Exception e)
    e.printStackTrace();
    finally
    PL/SQL Wrapper :
    create or replace procedure rc (cmd VARCHAR2) as
    language java name 'Util.RunThis(java.lang.String)';
    Execution:
    begin
    rc('c:\dba_tools\jobs\test.cmd');
    end ;
    D:\oracle\ora92\DATABASE>date /t
    Fri 03/26/2004
    D:\oracle\ora92\DATABASE>time /t
    10:48 AM
    PL/SQL procedure successfully completed.
    SQL> /
    D:\oracle\ora92\DATABASE>date /t
    Fri 03/26/2004
    D:\oracle\ora92\DATABASE>time /t
    10:48 AM
    PL/SQL procedure successfully completed.
    SQL> /
    D:\oracle\ora92\DATABASE>date /t
    Fri 03/26/2004
    D:\oracle\ora92\DATABASE>time /t
    10:49 AM
    PL/SQL procedure successfully completed.
    SQL> /
    D:\oracle\ora92\DATABASE>date /t
    Fri 03/26/2004
    D:\oracle\ora92\DATABASE>time /t
    10:50 AM
    PL/SQL procedure successfully completed.
    SQL>
    The only thing I really changed was the reurn value from the java procedure. If it has a return value then it should be declared as a function, not a procedure. Since you probably (apparently) weren't using the return value I dropped it and made it a procedure.

  • Expanding text java script

    I got a java script from a coworker that allows me to click
    on a button and display expanded text. The problem is, when its
    clicked, the page jumps back to the top of the page. Any ideas?
    Here is a sample of the code:
    <a href="#"
    onclick="document.getElementById('what_is').style.display=(document.getElementById('what_ is').style.display=='block')?'none':'block';"><img
    src="Images/More.jpg" border="0" align="left" />
    Thanks!!!!
    PS- please be gentle, I have never used java script before.
    :)

    nst_21710 wrote:
    > I got a java script from a coworker that allows me to
    click on a button and
    > display expanded text. The problem is, when its clicked,
    the page jumps back to
    > the top of the page. Any ideas?
    >
    > Here is a sample of the code:
    > <a href="#"
    >
    onclick="document.getElementById('what_is').style.display=(document.getElementBy
    >
    Id('what_is').style.display=='block')?'none':'block';"><img
    > src="Images/More.jpg" border="0" align="left" />
    >
    > Thanks!!!!
    >
    > PS- please be gentle, I have never used java script
    before. :)
    >
    replace:
    <a href="#"
    with:
    <a href="javascript:;"
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    Downloads: Slide Show, Directory Browser, Mailing List

  • How to call a java method in a Stored procedure

    Hi.,
    I was trying to call a method in a stored procedure
    This was my procedure
    CREATE OR REPLACE PROCEDURE proc_copy_file(sr_file VARCHAR2,dt_file VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'FileCopy.copyfile(String,String)'; // calling a java method
    /   this was my java method
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "FileCopy" as
    import java.io.File;
      import java.io.IOException;
      import java.io.FileReader;
      import java.io.FileWriter;
      import javax.imageio.stream.FileImageInputStream;
      import javax.imageio.stream.FileImageOutputStream;
      import java.security.AccessControlException;
      public class FileCopy {
          // Define variable(s).
              private static int c;
              private static File file1,file2;
              private static FileReader inTextFile;
              private static FileWriter outTextFile;
              private static FileImageInputStream inImageFile;
              private static FileImageOutputStream outImageFile;
              // Define copyText() method.
              public static void copyfile(String fromFile,String toFile) throws AccessControlException
                // Create files from canonical file names.
                file1 = new File(fromFile);
                file2 = new File(toFile);
                // Copy file(s).
                try
                  // Define and initialize FileReader(s).
                  inTextFile  = new FileReader(file1);
                  outTextFile = new FileWriter(file2);
                  // Read character-by-character.
                  while ((c = inTextFile.read()) != -1) {
                    outTextFile.write(c); }
                  // Close Stream(s).
                  inTextFile.close();
                  outTextFile.close(); }
                catch (IOException e) {
                  System.out.println ("-------"); }
             // return 1;
          public static void main(String[] args){
                          switch(args.length){
                                  case 0: System.out.println("File has not mentioned.");
                                                  System.exit(0);
                                  case 1: System.out.println("Destination file has not mentioned.");
                                                  System.exit(0);
                                  case 2: copyfile(args[0],args[1]);
                                                  System.exit(0);
                                  default : System.out.println("Multiple files are not allow.");
                                                    System.exit(0);
    };while i am executing this method i m getting error as
    ORA-29531: NO METHOD COPYFILE IN CLASS FILECOPY
    ORA-06512: AT "RMVER721.PROC_COPY_FILE", LINE 1could anyone help me

    Looks like it is a matter of not quite the same namespace for String object.
    I can get it to work by the java source containing:
              public static void copyfile(java.lang.String fromFile,java.lang.String toFile) throws AccessControlExceptionAnd the PL/SQL source:
    NAME 'FileCopy.copyfile(java.lang.String,java.lang.String)'; // calling a java methodSeems like when you just use "String", then the namespace resolving in the java source is not the same as the namespace resolving in the PL/SQL?
    Addendum:
    You do not need to put java.lang.String in the java source, String will do (java.lang is by default "imported"?)
    But in the PL/SQL source java.lang namespace prefix is needed - java.lang is not "imported" here.
    Edited by: Kim Berg Hansen on Nov 23, 2011 1:07 PM

  • Calling a java loaded API from PL/SQL

    HI,
    I have a java program loaded in the Database.
    For sake of clarity I am posting the java Program also.
    package mypackage1;
    public class WriteClob extends CLOB
    public static void main(String[] args) {
    Connection conn = null;
    String url = null;
    String user = null;
    String password = null;
    Properties props = new Properties();
    String fileName = null;
    String xml_test ="KINGSTON";
    StringBuffer s_xml = new StringBuffer();
    // PreparedStatement ps = null;
    OraclePreparedStatement ps=null;
    int ret_int=0;
    props.put("user", "apps" );
    props.put("password", "apps");
    long len=0;
    int temp;
    ResultSet rs = null;
    SimpleDateFormat fSDateFormat = null;
    props.put("SetBigStringTryClob", "true");
    long first=System.currentTimeMillis();
    url = "jdbc:oracle:thin:@ap619sdb:4115:owf12dev";
    user = "apps";
    password = "apps";
    try
    DriverManager.registerDriver(new OracleDriver()); // Get the database connection
    conn = DriverManager.getConnection( url, props );
    long second=System.currentTimeMillis();
    System.out.println("Time between conn. "+(second-first));
    first=System.currentTimeMillis();
    for (int i =0;i<1000;i++){
    s_xml.append(xml_test);
    second=System.currentTimeMillis();
    System.out.println("Time between loop "+(second-first));
    first=System.currentTimeMillis();
    ps =(OraclePreparedStatement) conn.prepareStatement("insert into xml_clob_temp1 values(:1)");
    ps.setString(1,s_xml.toString());
    ps.executeUpdate();
    second=System.currentTimeMillis();
    System.out.println("Time between loop "+(second-first));
    } catch(SQLException sqlexp){ sqlexp.printStackTrace(); }
    Now i am trying to create a procedure to call this Java API.
    create or replace package load_perf as
    procedure WriteClob ;
    end;
    create or replace package body load_perf as
    procedure WriteClob
    is
    language java name 'mypackage1.WriteClob.main(java.lang.String)';
    end;
    I have tried debugging this a lot and am not able to overcome this error while creating the procedure.
    LINE/COL ERROR
    3/1 PL/SQL: Item ignored
    5/15 PLS-00311: the declaration of
    "mypackage1.WriteClob.main(java.lang.String)" is incomplete or
    malformed
    I have earlier created Java APIs which have returned some value and have been able to load them in the DB and call through a PL/SQL function wrapper.
    But I am unable to create a procedure for this.
    I have tried all sorts of debugging but always am getting error around this.
    Can someone Please take a look at this Pronblem.
    Thanks In Advance,
    Gaurav

    A proper designed application in the database tier is far more scalable and performs better than using a separate middle tier for the application.
    This should be self evident.
    A middle tier requires more moving parts between the application and data. There now sits a network pipe between application and data. There are more software layers that slows down the interaction of the application with the data - more stuff that can go wrong. More stuff that needs to be maintained and configured and secured.
    What's more, the database tier is a lot more scalable than the middle tier. Oracle Real Application Clusters. Oracle Parallel Processing. Oracle Shared Server. Etc.
    These are robust and mature technologies.
    One major fact that seems to be missed by so-called IS architects favouring a middle tier is that the middle tier cannot make a single database query or transaction go faster.
    Scaling the middle tier is done by throwing more hardware at it. But not a single additional mid-tier h/w platform will make the database tier any faster. Will make the database tier scale.
    Then there is also the issue of costs. A middle tier requires additional hardware. It requires support and maintenance agreements with the vendors. It requires middle tier software to be purchased. It requires a new set of skills to do middle tier development. It deals with different technology and different programming languages.
    Why? How can this approach be sensible when:
    - Oracle scales exceedingly well (and this scalability is not dependent on more h/w purchasing)
    - Oracle deals with a single programming language (PL/SQL)
    - Oracle supports high availability
    - Oracle supports redudancy
    - Oracle supports the complete application tier inside the database
    If you have problems now leveraging Oracle (as an application tier), then you will have more problems when doing it a middle layer. Why?
    Because the lack of experience/skill/knowledge required to make Oracle work for you, is not now suddenly negated and not needed when moving the application tier to Java.

  • How to uninstall Java 7 and install Java 6

    I recently updated to OS X Lion 10.7.5, I have very important application that run Java 6, but the update removed Java 6 and the Java Preferences app and replaced it with Java 7, I am very unhapp with this and have searched online for nearly 4 hours for a fix to my problem.  I just want Java 6 back, and no, I don't want to Archive and reinstall, and I don't want to pay $20 for Mountain Lion update.  I want Java 6 back.

    JordanLT wrote:
    I recently updated to OS X Lion 10.7.5, I have very important application that run Java 6, but the update removed Java 6 and the Java Preferences app and replaced it with Java 7,
    That's not really true. It removed the browser plugin and if you try to replace it you will be taken to Oracle for Java 7, but it's not clear what happens when you do that. Check in System Preferences for the Java preference pane and see what it says. Type "java -version" in Termina and see what it says. Does it replace all of Java 6, or just the plugin with Java 7.

Maybe you are looking for

  • How to Get the values from Dynamic jasp page

    Hi, I have a jsp form page wherein i input the data form the user and get these values on the action servlet. But now i have added a feature to Add and Delete the Elements using javascript and this creates a dynamic form on the jsp page. I want to Ge

  • Getting the label from a radio selection in a radio buttons box

    I am using a radio buttons control, with four radio selections in it.  I understand that this is an enumerated type, so the value is a "number."  When you wire that control to a case statement, the case is auto-populated with the labels of the radio

  • After Safari 8.0.4 update only certain pages will open - can anyone help me?

    After updating the Safari 8.0.4 security update today only certain webpages will load - ideas anyone?

  • Programmatically inserting row in ViewObject

    I have created Entity Object based on table and updatable VO based on the Entity. Now i need to add a new row in the table. I have a button Add new row , on button click a popup will open with the fields in the row. Entering the field ,clicking on OK

  • "preview" is fine, but it doesn't "burn" that way

    I created an iDVD project from stuff put together in iMovie. (about 25 minutes) I burned about 20 copies just fine. Now, however, newly burned dvd copies are missing lots of stuff but the raw video from the camera - no title page, no music, no photos