How to get comparable Oracle JDBC performance using Java 1.4 vs 1.1.7?

Our application makes extensive use of JDBC to access an Oracle database. We wrote it a number of years ago using java 1.1.7 and we have been unable to move to new versions of java because of the performance degradation.
I traced the problem to JDBC calls. I can reproduce the problem using a simple program that simply connects to the database, executes a simple query and then reads the data. The same program running under java 1.4 is about 60% slower than under java 1.1.7. The query is about 80% slower and getting the data is about 150% slower!
The program is attached below. Note, I run the steps twice as the first time the times are much larger which I attribute to java doing some initializations. So the second set of values I think are more representative of the actual performance in our application where there are numerous accesses to the database. Specifically, I focus on step 4 which is the execute query command and step 5 which is the data retrieval step. The table being read has 4 columns with 170 tuples in it.
Here are the timings I get when I run this on a Sparc Ultra 5 running
SunOs 5.8 using an Oracle database running 8.1.7:
                 java 1.1.7  java 1.4
        overall:    2.1s         3.5s
        step 1:     30           200
        step 2:    886          2009
        step 3:      2             2
        step 4:      9            17
        step 5:    122           187
        step 6:      1             1
        step 1:      0             0
        step 2:    203           161
        step 3:      0             1
        step 4:      8            15   <-   87% slower
        step 5:     48           117   <-  143% slower
        step 6:      1             2I find the same poor performance from java versions 1.2 and 1.3.
I tried using DataDirect's type 4 JDBC driver which gives a little better performance but overall it is still much slower than using java 1.1.7.
Why do the newer versions of java have such poor performance when using JDBC?
What can be done so that we can have performance similar to java 1.1.7
using java 1.4?
========================================================================
import java.util.*;
import java.io.*;
import java.sql.*;
public class test12 {
    public static void main(String args[]) {
        try {
                long time1 = System.currentTimeMillis();
/* step 1 */  DriverManager.registerDriver(
                    new oracle.jdbc.driver.OracleDriver());
                long time2 = System.currentTimeMillis();
/* step 2 */  Connection conn = DriverManager.getConnection (
              "jdbc:oracle:thin:@dbserver1:1521:db1","user1","passwd1");
                long time3 = System.currentTimeMillis();
/* step 3 */  Statement stmt = conn.createStatement();
                long time4 = System.currentTimeMillis();
/* step 4 */  ResultSet rs = stmt.executeQuery("select * from table1");
                long time5 = System.currentTimeMillis();
/* step 5 */  while( rs.next() ) {
                  int message_num = rs.getInt(1);
                  String message = rs.getString(2);
                long time6 = System.currentTimeMillis();
/* step 6 */  rs.close(); stmt.close();
                long time7 = System.currentTimeMillis();
            System.out.println("step 1: " + (time2 - time1) );
            System.out.println("step 2: " + (time3 - time2) );
            System.out.println("step 3: " + (time4 - time3) );
            System.out.println("step 4: " + (time5 - time4) );
            System.out.println("step 5: " + (time6 - time5) );
            System.out.println("step 6: " + (time7 - time6) );
            System.out.flush();
        } catch ( Exception e ) {
            System.out.println( "got exception: " + e.getMessage() );
        ... repeat the same 6 steps again...
}

If I run my sample program with the -server option, it
takes a lot longer (6.8s vs 3.5s).Which has to be expected, as the -server option optimizes for long running programs - so it shoudl go with my second suggestion, more below...
I am not certain what you mean by "just let the jvm
running". Our users issue a command (in Unix) which
invokes one of our java programs to access or update
data in a database. I think what you are suggesting
would require that I rewrite our application to have a
java program always running on the users workstation
and to also rewrite our
commands (over a hundred) to some how pass data and
receive data with this new server java program. That
does not seem a very reasonable just to move to a new
version of java. Or are you suggesting something
else?No I was just suggestion what you descript. But if this is not an option, then maybe you should merge your java-programs to C or another native language. Or you could try the IBM-JDK with the -faststart (or similar) option. If thew Unix you mention is AIX, then there would be the option of a resetable-vm. But I cannot say if this VM would solve your problem. Java is definitly not good for applications which only issue some unqiue commands because the hotspot-compiler can not be efficiently used there. You can only try to get 1.1.7 performance by experimenting with vm-parameters (execute java -X).

Similar Messages

  • How do you query Oracle RDF database using Java program?

    Does anyone know how to get data out of the oracle RDF database using Java?
    I'm running the following java code and it returns basically null values. My guess is that the get_triple() function returns a dataset other than resultset. I've tried searching the Oracle web site. Am I supposed to be using CLOB object? Any help would be appreciated. Thanks
    sql = "SELECT a.triple.GET_TRIPLE() AS triple FROM family_rdf_data a";
    ResultSet rs = stmt.executeQuery( sql ) ;
    while ( rs.next() )
    System.out.println( rs.getString(1) ) ;
    rs.close() ;

    get_triple() returns an object, and the code would be different from the code of retrieving a string. Some sample code for retrieving objects is at http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.html
    get_subject(), get_property() return strings so the code below should work. get_object() returns a CLOB so different handling would be required and there is some sample code at the link above.
    Melli

  • How i get user info from ldap using java after authenticating user with SSO

    Hi
    I have one jsp/bean application as a partner application with SSO.
    It works fine.
    Now i need to get other attributes of user from LDAP who has logged into the application through SSO.
    using SSO java APIs i only get username, userDN, subscriber info.
    To get user's other attribute i have to user LDAP APIs for that i have to create on Directory Context, for the same i need userpassword.
    so here i my question, how do i get user password after he has logged in thro SSO.
    regards..
    and thanking u in advance
    samir

    Valentina,
    there's no way to get the password value from the directory (it's one way). Of course you can get the hashed (MD4,MD5,SHA-1) base64 encoded value (i.e. the value you see in OiD) but not the 'password'.
    --Olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get the hour:minuts:seconds using java

    I have table xydata
    here i get the gsTime like this 2010-04-21 10:58:40
    the above time i want to get only 10:58:40
    how to write the java for this
    please help me
    Thanks in Advance

    Problem of this sort cry out for using regular expressions. It is what they were invented for. If the OP wanted the whole date parsed into a java.util.Date then it would be a different matter and SimpleDateFormat would be the way to go but extracting part of a string is what regular expressions are best at.
    In this case, even a regular expression approach is far too complex. Which of the following do you consider the most appropriate ?
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class Sabre20100508
        public static void main(String[] args) throws Exception
            String[] lines =
                "2010-04-21 11:01:35",
                "2010-04-21 11:01:58",
                "2010-04-21 11:02:21",
                "2010-04-21 11:02:42",
                "2010-04-21 11:03:28",
                "2010-04-21 11:03:51"
                Pattern p = Pattern.compile("(?<= )\\d{2}:\\d{2}:\\d{2}");
                System.out.println("Method 1 :-");
                for (String line : lines)
                    Matcher m = p.matcher(line);
                    if (m.find())
                        System.out.printf("    [%s]\n", m.group());
                Pattern p = Pattern.compile("\\d{4}-\\d{2}-\\d{2} (\\d{2}:\\d{2}:\\d{2})");
                System.out.println("Method 2 :-");
                for (String line : lines)
                    Matcher m = p.matcher(line);
                    if (m.matches())
                        System.out.printf("    [%s]\n", m.group(1));
                System.out.println("Method 3 :-");
                for (String line : lines)
                    String[] splitLIne = line.split(" ", 2);
                    System.out.printf("    [%s]\n", splitLIne[1]);
                System.out.println("Method 4 :-");
                for (String line : lines)
                    int index = line.lastIndexOf(" ");
                    System.out.printf("    [%s]\n", line.substring(index + 1));
                System.out.println("Method 5 :-");
                SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
                for (String line : lines)
                    Date date = parser.parse(line);
                    System.out.printf("    [%s]\n", formatter.format(date));
                System.out.println("Method 6 :-");
                for (String line : lines)
                    System.out.printf("    [%s]\n", line.replaceAll("[^ ]* ", ""));
    }My vote goes to method 4!

  • How to get server date and time using java code

    Hi,
    I'm new to java. I have one doubt about getting date and time of the server. can anyone give some sample code to get that.
    thanks in regards
    Gopi.

    you need 2 things
    1. something on the application server which exposes the servers time/date
    2. something on the client which makes use of your time service
    for instance, you could write a ServerTimeServlet that clients can call to get the time according to the server. or, if you've got a database in the server, often database software will provide a Time procedure or similar that does this, so you can use a simple SQL query to get the latest time

  • Any idea how to get Blackboard Collaborate to run using Java 6?

    Up until Oct 22, I was able to load Blackboard collaborate without any problems.  Now it will not load.  It gets stuck trying to access Java 6.  Blackboard says it is a Java problem.  Java says it does not support Java 6 to consult Apple.  I am running OS 10.6.8. and Java 1.6.0_65.  Blackboard tells me to update to at least OS 7 and they can not guarantee it will work with Maverik!
    Strange part is that sometimes I can get into Blackboard.  Usually I can not.
    Anyone else out there experiencing the same problem?  HELP! 

    Both copy tasks dont work.
    I will dblcheck whether I am running Diagnostic. 
    <do you call MSBuild recursively ?
    That I am not sure. It's TFS that runs it. Am I missing something?
    Thanks
    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.
    a few seconds ago
    Reply
    |
    Quote
    |
    Mark as answer
    |
    Report
    as abuse 
    Daniel_Steiner
    (MCC)
    13,505 Points
    <form style="margin:0px;padding:0px;border:0px;font-size:16.7999992370605px;vertical-align:baseline;"></form>
    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.
    a few seconds ago
    Reply
    |
    Quote
    |
    Mark as answer
    |
    Report
    as abuse 
    Daniel_Steiner
    (MCC)
    13,505 Points
    <form style="margin:0px;padding:0px;border:0px;font-size:16.7999992370605px;vertical-align:baseline;"></form>
    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.
    a few seconds ago
    Reply
    |
    Quote
    |
    Mark as answer
    |
    Report
    as abuse 
    Daniel_Steiner
    (MCC)
    13,505 Points
    <form style="margin:0px;padding:0px;border:0px;font-size:16.7999992370605px;vertical-align:baseline;"></form>

  • To get JRE or JDK version using Java Programs

    How do get JRE or JDK version using Java Programs?.
    Kindly Reply...
    By
    Mani

    If you're talking about current program's runtime environment (as opposed to all installed JDK/JRE) : System properties

  • How to get inputtext's inputvalue by using javascript

    how to get inputtext's inputvalue by using javascript?
    and how to judge whether its be filled or empty string

    Why do you want to use javascript..? Why not action listener..? You can check whether its an empty string by checking
    if(str != null && !str.equals("")) {..}
    where str is the variable for inputText value.
    If this is not helpful, do provide more details on which version of JDev you are using and what are you trying (your usecase).
    regards,
    ~Krithika

  • How to get Default Activity(Infotype 0315) using BAPI

    Hi Everyone,
    I have a task to get Default Activity by Personal number for my third party application. Unfortunately function HR_READ_INFOTYPE is not allowed for Remote Call.
    Is there any simple way how to get this value from system using BAPI? E.e. using RFC_READ_TABLE function(but i don't know table name ).
    Thanks,
    Roman.

    Table -> PA0315        Field ->LSTAR (Activity Type)
    Class :CL_HRPT_INFOTYPE_0315
    You can also use FM "CATS_GET_INFOTYPE_0315" RFC Enable
    Good luck !
    ~Saquib

  • How to run the oracle application cleint using static ip or domain please e

    How to run the oracle application cleint using static ip or domain please explain me.
    i am not able to run oracle forms in client machine how to run it please explain me
    Please give me detail regarding that
    any body please help me.
    my mail id::::: [email protected]

    You did not mention exactly which Forms version you are using so it will be difficult to offer specific help. However, you did mention Forms 9i. ALL "9i" releases were desupported long ago, so find software or documentation are becoming more difficult.
    Here is the Deployment Guide for Forms 10.1.2
    http://download.oracle.com/docs/cd/B19375_07/doc/frs/forms/B14032_03/toc.htm
    Here are some technical reference for Forms 9.0.x
    http://www.oracle.com/technology/products/forms/techlisting9i.html

  • When I open a pdf file, after a few seconds, it hides the toolbar and I don't know how to get it back.  I use multiple monitors and, without being able to grab the toolbar, I am unable to move the pdf file to a different monitor.  How do I stop this?

    When I open a pdf file, after a few seconds, it hides the toolbar and I don't know how to get it back.  I use multiple monitors and, without being able to grab the toolbar, I am unable to move the pdf file to a different monitor.  How do I stop this?

    Does Firefox switch to full screen if you press F11 ?
    You can also try the F10 key to see if that brings up the menu bar.
    * If the above steps didn't help then see http://kb.mozillazine.org/Corrupt_localstore.rdf
    Note: Do not delete localstore.rdf in the program folder (Windows: "C:\Program Files\Mozilla Firefox\defaults\profile\") (Mac: "/Applications/Firefox.app/defaults/profile/")

  • How can we get requester's user id using java code

    Hi,
    How can we get requester's user id using java code?
    eg: If i had logged in as xelsysadm and request a resource for user uid101 on the userid field it should display uid101 and not xelsysadm.
    also,
    I have a resoure "A" which on revoking should also revoke resources B and C. How can it be done. Resource A, B, and C are 3 different resource objects.
    ==Thanks,
    doki

    Ok, so there is a way, but it's not available during submission. You can use the findRequests api. From the result set, get the "Requests.Consolidated Data Value" value. In this information, you will get an xml formatted data. It provides the list of users on the request on the left side after submission. After the request is completed, this value is available. Upon completion, you could get the request information, get this value, and parse the information for user ids.
    In the same adapter, use the following API:
    formIntf.setObjectFormData(objInstanceKey, formHash)
    The formHash is a hashtable containing the field name on your object form, and the values you wish to populate it with. You could create a textarea box on your object form and populate the userids for who the request is for.
    However, this makes absolutely 0 sense. When you get a request, the list of userids are listed right there on the request.
    -Kevin

  • How to  get the profile object in simple java class  (Property accessor)

    Hi All,
    Please guide me how to get the profile object in simple java class (Property accessor) which is extending the RepositoryPropertyDescriptor.
    I have one requirement where i need the profile object i.e i have store id which is tied to profile .so i need the profile object in the property accessor of the SKU item descriptor property, which is extending RepositoryPropertyDescriptor.
    a.I dont have request object also to do request.resolvename.
    b.It is not a component to create setter and getter.It is simple java class which is extending the RepositoryPropertyDescriptor.
    Advance Thanks.

    Iam afraid you might run into synchronization issues with it. You are trying to get/set value of property of a sku repository item that is shared across various profiles.
    Say one profile A called setPropertyValue("propertyName", value).Now another profile B accesses
    getPropertyValue() {
    super.getPropertyValue() // Chance of getting value set by Profile A.
    // Perform logic
    There is a chance that profile B getting the value set by Profile A and hence inconsistency.
    How about doing this way??
    Create PropertyDescriptor in Profile (i.e user item descriptor), pass the attribute CustomCatalogTools in userProfile.xml to that property.
    <attribute name="catalogTools" value="atg.commerce.catalog.CustomCatalogTools"/>
    getPropertyValue()
    //You have Profile item descriptor and also storeId property value.
    // Use CustomCatalogTools.findSku();
    // Use storeId, profile repository item, sku repository item to perform the logic
    Here user itemdescriptor getPropertyValue/setPropertyValue is always called by same profile and there is consistency.
    -karthik

  • How to display a oracle table from a java program?

    How to display a oracle table from a java program.
    Hello friends, I have written a Java program, using oracle 10g as backend.
    I want to display a oracle table as output. Im not getting how to display oracle table as a output table.. Pls help me
    Thank you

    jayanthds, you're not going to get a satisfactory
    answer to this here. it's too big a task to justbe
    quickly outlined in a forum - the reply "all youneed
    to do is to query you table and return it asJTable"
    is worthless, for example, since the solution to
    any problem can be distilled to such a
    soundbite, if need be. doesn't make the solutionany
    simpler
    essentially you're asking "how do I write adatabase
    application?". all you'll get is snippets of code
    that, when fitted together, will eventually helpyou
    do this, but you'll spend days and days comingback
    saying "right, I've done that, now what?" until
    either you or the forum gets frustrated with the
    whole affair and the process stops
    there are entire books written about this subject,
    and countless tutorials and guides on theinternet.
    you're better off going down that routehehehe.well, it's true! I used to have a manager that would outline the solution to a problem in a few lines of pseudocode, and then firmly believe that the actual solution would be just as brief and simple. shame his pseudocode included such lofty abstractions as "reformat all data"

  • How to get the current GMT time in java

    Hi,
    How to get the current GMT time in java
    Thanks

    System.getCurrentTimeMillis() or new Date().
    [url http://www.javaworld.com/jw-12-2000/jw-1229-dates.html]Calculating Java dates: Take the time to learn how to create and use dates
    [url http://www.javaalmanac.com/egs/java.text/FormatDate.html]Formatting a Date Using a Custom Format

Maybe you are looking for