MySQL JDBC Performance Issues

Hi, First off, let me admit, im a java newbie. I've been using java for about 6 months now, although im a fast learner, some things still elude me.
I've searched these forums and google high and low for an answer to my question before signing up and posting here, so i'm kind of at my wits end.
Let me explain my specs so noone blames lack of power for this issue.
System specs:
Linux Cent OS 4 2.6.19 SMP
JRE 1.6
MySQL 4.2.2 ICC Compiled Enterprise Edition
4x HyperThreaded Xeon 1.9Ghz cpus (Displays as 8)
16GB ECC Double-Parity Double-Buffered Memory. (Rediculous IBM proprietary memory)
Problem:
I first wrote this application in PHP as it my stong suit (that should tell you plenty). But the PHP CLI was eating up way to much CPU power/MySQL bandwith to execute this script, and taking way to long, so i started re-writing it in C++, well when my feeble C++ powers failed me, i went to Java. I know more Java then C++ but i picked C first because i thought it would be the fastest. Java, however, is slower then PHP when i write the identical logic, i dont know if i should blame Java or my assumption that i can copy logic from one language to another.
Here is the details:
I have 1 MySQL database and 2 Tables im pulling from, This mysql database is optimized by the people from MySQL, so i know its not the DB, Server, or Tables. 1 table (bfpax) has around 45k rows (45000), the second table (bfbdet) has around 100k rows (100000). What this program has to do, its objective, is:
1. Pull the indexed ID from table 1;
2. With that ID, pull other data from table 2 and table 1 for each ID;
3. Compile that data together for each ID
4. Insert compiled data into a HEAP table for fast access for each ID.
In PHP (pseudocode):
SELECT ID FROM bfpax;
Loop:
Foreach id pull various data pieces i.e. name, client code, address, zip, etc.
String format name: "A-GARY/COLE" becomes "Gary/Cole"
String format hotel: "ACUNMIP" becomes CUNMIP
Insert all formatted/fixed data into heap table
End loop.
In Java (pseudocode):
SELECT ID FROM cpax;
Loop:
Create object with ID as constructor variable (see below for object declaration) and add to an arrayList;
End Loop;
Create 6 threads to execute each of the objects methods for data collection/formatting
Start each thread using inner classes to loop through the object arraylist and execute dedicated methods per thread.
Thread 1: Pull air data
Thread 2: Pull destination
Thread 3: Pull hotel
Thread 4: Pull gateway
Thread 5: Pull the rest (price, dates, etc)
Thread 6: Start executing the update method
The above kind of failed, so i reduced the complexity by nuking the whole thread idea and now i just have a simple function that loops through the arraylist of objects and executes each method in order.
Booking Object:
public class Booking extends ReportingConstants{
    private ArrayList<String> myData = new ArrayList<String>();
    private int myBookNum;
    private static Connection myCon;
    public static int numBookings;
    public int updateCount = 0;
    public boolean isFinished = false;
    public Booking(int booking_number, Connection conn) {
        if (booking_number > 9999) {
            myBookNum = booking_number;
        numBookings++;
        myCon = conn;
        //Run loop to make sure myData has the proper spaces for insert, ensureCapacity didnt work.
        for (int i = 0; i < 15; i++) {
            myData.add("");
        myData.set(_BOOKNUM,String.valueOf(myBookNum));
        if (Integer.valueOf(_ARGS[_DEBUG][1]) > 0) {
            System.out.println("Initialized booking number "+myBookNum+" count "+numBookings);
    public void getAir() {
        ResultSet res;
        ArrayList<String> total_air = new ArrayList<String>();
        String airlines = "";
        String query = "SELECT operator_id FROM EDITED.bfbdet WHERE record_type = 'A' AND item_desc LIKE '-%' AND booking_number = "+myBookNum+" AND operator_id IS NOT NULL";
        if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
            System.out.println("Starting Air: "+query);
        res = MySQL.sqlQuery(query,myCon,5);
        try {
            while(res.next()) {
                if (res.getString(1).length() > 1) {
                    String id = res.getString(1).substring(0,2);
                    if (!total_air.contains(id)) {
                        airlines += id+",";
                    total_air.add(id);
            res.close();
            MySQL.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        myData.set(_AIR,airlines);
        updateCount++;
    public void getDest() {
        String query = "SELECT booking_code FROM EDITED.bfpax WHERE booking_number = "+myBookNum+" LIMIT 1";
        ResultSet res;
        String isSv ="Y";
        String dest;
        if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
            System.out.println("Starting Dest: "+query);
        res = MySQL.sqlQuery(query,myCon,1);
        try {
            while (res.next()) {
                dest = res.getString(1).substring(1,4);
                if (dest != "FRE") {
                    if (dest == "GYY") {
                        String realDest = res.getString(1).substring(4,2);
                        if (realDest == "GY") {
                            dest = "GYY";
                        } else if (realDest == "MC") {
                            dest = "MCO";
                        } else if (realDest == "FL") {
                            dest = "FLL";
                        } else if (realDest == "IW") {
                            dest = "IWA";
                        } else if (realDest == "PI") {
                            dest = "PIE";
                        } else if (realDest == "LA") {
                            dest = "LAS";
                        } else {
                            dest = "GYY";
                    } else {
                        isSv = "N";
                    myData.set(_DEST,dest);
                    myData.set(_SV,isSv);
                    updateCount++;
            res.close();
            MySQL.close();
        } catch (Exception ex) {
            ex.printStackTrace();
    public void getGateway() {
        String query = "SELECT item_desc FROM EDITED.bfbdet WHERE (booking_number = '"+myBookNum+"' OR booking_number = ' "+myBookNum+"') AND item_desc LIKE '-%' ORDER BY booking_suffix ASC LIMIT 1";
        if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
            System.out.println("Starting GW: "+query);
        ResultSet res = MySQL.sqlQuery(query,myCon,1);
        String gw;
        try {
            while (res.next()) {
                gw = res.getString(1).substring(1,3);
                myData.set(_GW,gw);
            updateCount++;
            res.close();
            MySQL.close();
        } catch (Exception ex) {
            ex.printStackTrace();
    public void getHotel() {
        String query = "SELECT operator_id FROM EDITED.bfbdet WHERE record_type = 'H' AND (booking_number = '"+myBookNum+"' OR booking_number = ' "+myBookNum+"') LIMIT 1";
        if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
            System.out.println("Starting Hotel: "+query);
        ResultSet res = MySQL.sqlQuery(query,myCon,1);
        String hotel = "";
        try {
            while (res.next()) {
                hotel = res.getString(1).substring(0,6);
                if (myData.get(_DEST) == "") {
                    myData.set(_DEST,res.getString(1).substring(0,3));
                    updateCount++;
            myData.set(_HOTEL,hotel);
            updateCount++;
            res.close();
            MySQL.close();
        } catch (Exception ex) {
            ex.printStackTrace();
    public void getRest() {
        String query = "SELECT client_code, passenger1_name, agentid, booked_date, dep_date, total_price, total_received, total_commission, number_pax FROM EDITED.bfpax WHERE booking_number = "+myBookNum+" LIMIT 1";
        if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
            System.out.println("Starting Rest: "+query);
        ResultSet res = MySQL.sqlQuery(query,myCon,1);
        try {
            while (res.next()) {
                myData.set(_AGENCY,res.getString(1));
                if (res.getString(3) != "null") {
                    myData.set(_AGENT,res.getString(3));
                } else {
                    myData.set(_AGENT,"");
                myData.set(_PAXNAME,res.getString(2).replace("'",""));
                myData.set(_BKDATE,String.valueOf(res.getDate(4)));
                myData.set(_DEPDATE,String.valueOf(res.getDate(5)));
                myData.set(_TPRICE,String.valueOf(res.getDouble(6)));
                myData.set(_TRECV,String.valueOf(res.getDouble(7)));
                myData.set(_TCOM,String.valueOf(res.getDouble(8)));
                myData.set(_NUMPAX,String.valueOf(res.getInt(9)).trim());
                //System.out.println("NUMPAX: |"+myData.get(_NUMPAX)+"|");
            updateCount++;
            res.close();
            MySQL.close();
        } catch(Exception ex) {
            ex.printStackTrace();
    public void storeData() {
        if (!isFinished) {
            String query = "INSERT INTO "+tmpTable+" (`booking_number`, `destination`, `gateway`, `airline`, `hotel`, `agency`, `agent`, `booked_date`, `dep_date`, `total_price`, `total_received`, `total_commission`, `number_pax`, `passenger_name`, `is_skyvalue`) VALUES('"+myData.get(0)+"','"+myData.get(1)+"','"+myData.get(2)+"','"+myData.get(3)+"','"+myData.get(4)+"','"+myData.get(5)+"','"+myData.get(6)+"','"+myData.get(7)+"','"+myData.get(8)+"','"+myData.get(9)+"','"+myData.get(10)+"','"+myData.get(11)+"','"+myData.get(12)+"','"+myData.get(13)+"','"+myData.get(14)+"')";
            if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
                System.out.println(query);
            MySQL.sqlExec(query,myCon);
            isFinished = true;
            if (Integer.valueOf(_ARGS[_DEBUG][1]) > 0) {
                System.out.println("Booking number "+myBookNum+" is finished!");
        } else {
            //System.out.println("Not fully populated!");
}Please dont laugh too hard heh, i know my code is sloppy and probably not optimized at all, i dont pretend to be a hardcore java guy, but i would love to learn. Im also posting below my static MySQL class so you can see what happens when i call sqlQuery();
public abstract class MySQL {
    private static ResultSet res;
    private static Statement stmt;
    public static ResultSet sqlQuery(String query,Connection con, int limit) {
        try {
            stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
            stmt.setFetchSize(limit);
            res = stmt.executeQuery(query);
        } catch(Exception ex) {
            ex.printStackTrace();
            res = null;
            System.out.println("Cant Query!: "+query);
        return res;
    public static void sqlExec(String query,Connection con) {
        Statement stmt;
        try {
            stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
            stmt.executeUpdate(query);
            stmt.close();
        } catch(Exception ex) {
            ex.printStackTrace();
            System.out.println("Cant Query!: "+query);
    public static void close() {
        try {
            stmt.close();
            res.close();
        } catch (Exception ex) {
            ex.printStackTrace();
}If you notice, i require the connection to be passed when executing a query, i do this because even if i made a static connection state in the MySQL class, for some reason, it still gets duplicated every time its called. This way, i create 1 connection with the calling static main class, and pass that same conn back and forth through the whole script. I know in PHP this is the best way to do it, in Java it may require many different connections.
By the way, this is an update that runs once per hour, it does not have to worry about users or anything like that, it gets executed by cron on the hour.
PHP does this job of updating about 40000 entries in 9-12 minutes. for an average of 0.0135 seconds per entry, Java rolls around at 0.06 seconds per query, 6x slower, this puts execution time at about 40 minutes, obviously this is an issue if its supposed to run every hour. The java app does not tax the system, on top/htop it does not even make it to the first page so its not resources, ive looked at the verbose gc info, and i didnt see anything to clue me in there either.
I'm sure this is a simple error and my lack of knowledge with Java is what's holding me back, but if i cant figure this out ill have to go back to struggling with C++.
Thanks in advance, and im sorry for the horribly long post.
Thanks,
Dave

I didnt want to include this in the original post, so here is where my main is located:
public class ReportingUpdate extends ReportingConstants {
    private ArrayList bookings;
    private static String[] argList;
    private static ArrayList<String> provArg = new ArrayList<String>();
    public ArrayList notDone = new ArrayList();
    private static Connection conn;
    public int bookingsUpdated;
    public static boolean isUpdating = false;
    private static int _ERRORS = 0;
    public static ArrayList doneBookings = new ArrayList();
    public static void main(String[] args) {
        if (args.length > 0) {
            if (args[0].contains("-help")) {
                printHelp();
            } else {
                setupArgs();
                argList = args;
                parseArgs();
        if (_ERRORS == 0) {
            new ReportingUpdate().go();
        } else {
            return;
    private static void parseArgs() {
        for (String s : argList) {
            if (s.indexOf("-") != 0) {
                printHelp();
                break;
            if (s.length() > 2) {
                provArg.add(s.substring(1,2));
            } else {
                printHelp();
                break;
        for (int i = 0; i < _ARGS.length; i++) {
            if (provArg.contains(_ARGS[0])) {
int pos = provArg.indexOf(_ARGS[i][0]);
ReportingConstants._ARGS[i][1] = argList[pos].substring(2);
//Commented out argument testing loop.
/*for (String[] s : _ARGS) {
System.out.println("Arg: "+s[0]+" Value: "+s[1]);
_ERRORS++;*/
public static void printHelp() {
System.out.println("\nReporting Update 1.1 (2007 February 1, compiled Feb 19 2007 11:12:24)");
System.out.println("");
System.out.println("Usage: java -jar /path/to/ReportingUpdate.jar [arguments]");
System.out.println("");
System.out.println("Arguments:");
System.out.println(" -d<level>\tDebug Level: 0-No Output(Default), 1-Start and finish output, 2-Functional Output(Lots of output)");
System.out.println(" -l<limit>\tBooking Limit. How many bookings will be updated, only use this for testing.");
System.out.println(" -a<0,1> \tBool choice to run the air update function, speed testing option. (0-0ff,1-On)\n \t\tIf this is not set, on is assumed");
System.out.println(" -e<0,1> \tSame as above, but for destination.");
System.out.println(" -g<0,1> \tSame as above, but for gateway.");
System.out.println(" -h<0,1> \tSame as above, but for hotel.");
System.out.println(" -r<0,1> \tSame as above, but for agency,agent,price & dates.");
System.out.println(" -u<0,1> \tSame as above, but for each bookings actual insert into the db.");
System.out.println("");
System.out.println("Example: java -jar /path/to/ReportingUpdate.jar -d1 -l500 -a0 -d0 -u0");
System.out.println("Run the reportingupdate with debug level 1, limit 500 bookings and do not run the air, destination or insert functions.\n");
_ERRORS++;
public void go() {
String limitString;
if (Integer.valueOf(_ARGS[_LIMIT][1]) > 0) {
limitString = "LIMIT "+_ARGS[_LIMIT][1];
} else {
limitString = "";
bookings = new ArrayList();
ResultSet res;
connect();
res = MySQL.sqlQuery("SELECT booking_number FROM EDITED.bfpax WHERE booking_number IS NOT NULL "+limitString,conn,Integer.valueOf(_ARGS[_LIMIT][1]));
try {
int i = 0;
while (res.next()) {
String booking = res.getString("booking_number");
booking = booking.trim();
if (booking.length() > 1) {
//System.out.println("Reading booking "+booking);
bookings.add(new Booking(Integer.valueOf(booking),conn));
i = 1;
startTheFire();
} catch(Exception ex) {
ex.printStackTrace();
private void startTheFire() {
/*Thread a = new Thread(new DoAir());
Thread b = new Thread(new DoDest());
Thread c = new Thread(new DoGW());
Thread d = new Thread(new DoHotel());
Thread e = new Thread(new DoRest());
Thread f = new Thread(new DoUpdate());
a.setName("Air");
a.start();
b.setName("Dest");
b.start();
c.setName("GW");
c.start();
d.setName("Hotel");
d.start();
e.setName("Rest");
e.start();
f.setName("Update");
f.start();
try {
f.sleep(20000);
} catch (Exception ex) {
ex.printStackTrace();
Iterator it = bookings.iterator();
while (it.hasNext()) {
Booking b = (Booking) it.next();
if (Integer.valueOf(_ARGS[_AIRARG][1]) > 0) {
b.getAir();
if (Integer.valueOf(_ARGS[_DESTARG][1]) > 0) {
b.getDest();
if (Integer.valueOf(_ARGS[_GWARG][1]) > 0) {
b.getGateway();
if (Integer.valueOf(_ARGS[_HOTELARG][1]) > 0) {
b.getHotel();
if (Integer.valueOf(_ARGS[_RESTARG][1]) > 0) {
b.getRest();
if (Integer.valueOf(_ARGS[_UPDATEARG][1]) > 0) {
b.storeData();
class DoAir implements Runnable {
public void run() {
Iterator it = bookings.iterator();
while(it.hasNext()) {
Booking tempBooking = (Booking) it.next();
tempBooking.getAir();
if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
System.out.println("Air is done!");
class DoDest implements Runnable {
public void run() {
Iterator it = bookings.iterator();
while(it.hasNext()) {
Booking tempBooking = (Booking) it.next();
tempBooking.getDest();
if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
System.out.println("Dest is done!");
class DoGW implements Runnable {
public void run() {
Iterator it = bookings.iterator();
while(it.hasNext()) {
Booking tempBooking = (Booking) it.next();
tempBooking.getGateway();
if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
System.out.println("Gateway is done!");
class DoHotel implements Runnable {
public void run() {
Iterator it = bookings.iterator();
while(it.hasNext()) {
Booking tempBooking = (Booking) it.next();
tempBooking.getHotel();
if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
System.out.println("Hotel is done!");
class DoRest implements Runnable {
public void run() {
Iterator it = bookings.iterator();
while(it.hasNext()) {
Booking tempBooking = (Booking) it.next();
tempBooking.getRest();
if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
System.out.println("The Rest is done!");
class DoUpdate implements Runnable {
public void run() {
while (bookingsUpdated <= Booking.numBookings) {
if (doneBookings.size() > 0) {
isUpdating = true;
Iterator it = doneBookings.iterator();
while (it.hasNext()) {
Booking b = (Booking) it.next();
b.storeData();
bookingsUpdated++;
it.remove();
isUpdating = false;
if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
System.out.println("Update is done!");
private void connect() {
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(_URL,_USER,_PASS);
} catch(Exception ex) {
System.out.println("Cannot Connect to: "+_URL);
ex.printStackTrace();
createTempTable();
private void createTempTable() {
String create_query = "CREATE TABLE IF NOT EXISTS `"+tmpTable+"` (`ID` INT( 5 ) NOT NULL AUTO_INCREMENT ,`booking_number` INT( 6 ) NULL ,`destination` CHAR( 3 ) NULL ,`gateway` CHAR( 3 ) NULL ,`airline` VARCHAR( 15 ) NULL ,`hotel` CHAR( 6 ) NULL ,`agency` VARCHAR( 15 ) NULL ,`agent` VARCHAR( 20 ) NULL ,`booked_date` VARCHAR( 10 ) NULL ,`dep_date` VARCHAR( 10 ) NULL ,`total_price` VARCHAR( 10 ) NULL ,`total_received` VARCHAR( 10 ) NULL ,`total_commission` VARCHAR( 10 ) NULL ,`number_pax` INT( 5 ) NULL ,`passenger_name` VARCHAR( 50 ) NULL,`is_skyvalue` CHAR( 1 ) NULL,PRIMARY KEY ( `ID` ),INDEX ( `booking_number` ),INDEX ( `agency` ) ) TYPE = memory;";
String trunc = "TRUNCATE TABLE `"+tmpTable+"`";
MySQL.sqlExec(create_query,conn);
MySQL.sqlExec(trunc,conn);

Similar Messages

  • Slow mySQL select - mySQL/JDBC/CFMX issue?

    Hello!
    I have got two simple SQL statements in my CFMX app:
    SELECT
    companyname,
    uidnumber,
    description,
    telephone
    FROM
    companies
    WHERE
    entrykey = ?
    Query Parameter Value(s) -
    Parameter #1(cf_sql_varchar) =
    2405961E-FE08-E3BE-059C648DC01198A9
    SELECT
    LEFT(companyname, 250) AS companyname,
    LEFT(uidnumber, 100) AS uidnumber,
    LEFT(description, 250) AS description,
    LEFT(telephone, 100) AS telephone
    FROM
    companies
    WHERE
    entrykey = ?
    Query Parameter Value(s) -
    Parameter #1(cf_sql_varchar) =
    2405961E-FE08-E3BE-059C648DC01198A9
    Both return the same result, but the second one only take 1
    msec, the first one 30 msec. The number of chars to return (using
    LEFT) is exactly the length of the field (no data is shortend).
    What could be the reason for that difference? Any methods to make
    query #1 as fast as query #2?
    system: JDBC 5.0 / myISAM tables with UTF-8 encoding / CFMX7
    app server
    best regards,
    Hansjoerg

    Hello!
    - Index exists, table is optimized (and currently has just 5
    records).
    - I tried to change the order, no change. The version with
    the simple naming of the desired fields is always up to 10-100
    times slower than the version with LEFT( ...).
    - I now went back to mysql-connector-java-3.0.17-ga-bin.jar
    from version mysql-connector-java-5.0.6 - now both queries have the
    same speed (about 1-3 msec).
    So it seems to be a JDBC driver issue but I cannot find any
    information on the net why the newer version is sooo much slower.
    Best regards,
    Hansjoerg

  • JDBC Performance Issue

    I am making call to Oracle Stored Proc on remote database .
    The values are taken in result set.The numbers of records in result set are aroung 6000.
    when I do
    while(rs.next())
    //My logic
    This takes aroung 5 min(300 sec) to get completed
    Now I commented all my logic inside while loop of rs.next()
    then also its taking around 4 min (250 sec) to just loop through records.
    Is there any way I can minize my time to just loop through records.
    I am using oracle thin driver to make connection.
    The Strored Proc takes just .05 sec for processing.
    Its while(rs.next()) loop where the problem actually is.
    After commenting all the programming logic I could gain only 0.5 sec.
    Is there something I could do on this

    I am making call to Oracle Stored Proc on remote
    database .
    The values are taken in result set.The numbers of
    records in result set are aroung 6000.
    when I do
    while(rs.next())
    //My logic
    This takes aroung 5 min(300 sec) to get completed
    Now I commented all my logic inside while loop of
    rs.next()
    then also its taking around 4 min (250 sec) to just
    loop through records.
    Is there any way I can minize my time to just loop
    through records.
    I am using oracle thin driver to make connection.
    The Strored Proc takes just .05 sec for processing.
    Its while(rs.next()) loop where the problem actually
    is.
    After commenting all the programming logic I could
    gain only 0.5 sec.
    Is there something I could do on thisProblem is in simple fact that Oracle's jdbc is buffering all records you've selected and when you goes step by step it buffers and buffers again and again. To make sure that all your records are buffered once and forever I would advice to call:
    rs.first();
    rs.last();To do that u have to create scrollable resultset like:
           Statement stmt = con.createStatement(
                                          ResultSet.TYPE_SCROLL_INSENSITIVE,
                                          ResultSet.CONCUR_UPDATABLE);
           ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
           // rs will be scrollable, will not show changes made by others,
           // and will be updatableand then loop through all your records
    Another approach is to use fetching (chunking) facility Statement.setFetchSize() and Statement.setFetchDirection() sometimes it also helps
    Pavel

  • Performance issues in Proxy-XI-Jdbc scenario

    Hello,
    I have developed a proxy to JDBC synchronous scenario.
    My scenario works like this.
    *i run an abap program which calls a client proxy,
    the proxy fetches the data from database table and returns the data in the ABAP program.(select query)
    there are serious performance issues when we are running the report
    it is taking around 2-5 minutes and at times multiple users are logged in , it takes around 5-20 minutes.
    it seems that most of the time is consumed in the data fetching.
    please help me to find some solution so that we can fine tune the performance on the PI side.
    Are there any options on JDBC CC which can help  us in making the queries faster
    thanks
    kannu.

    Kanu16 ,
    Issue seems to be at r/3 end..
    1. Make sur ethat report program is using select query in proper fashion .
    2. avoid using nested loops.
    3.  Hope not much validations are being done on selected data .
    Abaper can help you optimizing this .
    By debugging you can find out the exact reason behind.
    Regards ,

  • Mysql-jdbc applet connection issue

    I am developing a user interface for a mysql database. I am able to successfully access the db and execute queries through a java APPLICATION.
    I need to do the same (access the db (mysql)) through a java APPLET. When I compile the applet it complies fine. When I try to run the applet I'm getting the following error message:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    I tied running the applet using appletviewer and through a web browser, same result. I can run the application from the same command prompt it works fine.
    Please help.
    Relevant info:
    OS: Linux, Fedora4
    Classpath: export set CLASSPATH=/home/xyz/Java/mysql-connector-java-5.0.5/:$CLASSPATH;
    JDK: PATH=/usr/java/jdk1.6.0/bin
    Program:
    import java.sql.*;
    public class b extends java.applet.Applet
         int y = 0;
    public void paint(java.awt.Graphics g)
              y = y + 10;
    Connection conn = null;
    String driver = "com.mysql.jdbc.Driver";     
    String url = "jdbc:mysql://localhost:3306/testdb?user=usr1234&password=xyzxyz";
    try {
         Class.forName(driver).newInstance();
         conn = DriverManager.getConnection(url);
         System.out.println("Connected to the database.");
         System.out.println(" ");
         //*********BLOCK TO RETRIEVE RECORDS FROM TABLE*********          
                   try{
                        Statement st = conn.createStatement();
                        ResultSet res = st.executeQuery("SELECT * FROM table1");
                        System.out.println("Name: " + "\t" + "Age: ");
                        while (res.next()) {
                             String s = res.getString("name");
                             int i = res.getInt("age");
                             System.out.println(s + "\t" + i);
                   catch (SQLException s){
              y = y + 20;
    g.drawString("******* s: "+s,50,y);
         //*********END OF BLOCK TO RETRIEVE RECORDS FROM TABLE*********          
         conn.close();
         System.out.println("Disconnected from database");
         }      catch (Exception e) {
              y = y + 20;
    g.drawString("******* e: "+e,50,y);
                   e.printStackTrace();
    Thanks for the help in advance.
    --Mat                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    First, accessing a database from an applet is a horrendous idea.
    Having said that, did you add the mysql jar to the applet tag in the html page (in the archive property)?

  • MySQL jdbc speed

    Hello,
    I have a code - see below - which collects all fields of the available database tables. My problem is that this takes ~1sec with a Delphi code, but it takes ~15-20sec with the java implementation. It seems a little bit slow for me.
    I made some performance tests and it seems that most of the time are spent in com.mysql.jdbc.ResultSet and com.mysql.jdbc.MysqlIO.
    These 2 classes takes ~70% of the execution time. I use permanent connection. Is it possible to improve the speed with any trick?
    Thanks!
    My function wich is called for every database table:
       public ArrayList getFields(String tableName){
            logger.entry("getFields begin",this);
            ResultSet rs        = null;
            JFieldModel field   = null;
            ArrayList fieldList = new ArrayList();
            logger.info("Actual DB: "+database,this);
            String sqlStmt = "show full fields from "+tableName;
            rs  = executeSQL(sqlStmt);
            try{
                while (rs.next()){
                    field = new JFieldModel();
                    field.setDbFieldName(rs.getString(1));
                    field.setDbFieldType(rs.getString(2));
                    field.setDbFieldNull(rs.getBoolean(3));
                    field.setDbFieldDefault(rs.getString(5));
                    fieldList.add(field);
            catch (Exception e){
                logger.error("getFields() - Exception during read",this,e);
            logger.exit("getFields end",this);
            return fieldList;
        }

    There is no ability to run this on the command line, outside of Java and Delphi to get best case performance, which would be helpful, but not conclusive of anything.
    The cursor types are identical (forward only / read only).
    You are running the exact same queries that bring back the exact same results, so they will take the identical resources and time to execute on the database server(s).
    You have determined that there is no issue with data conversion, which I believe is done by the ResultSet Object (where you are spending all your time).
    Both the Delphi program and the Java program are executing on the same computer, so there is no difference in network latency, there is no difference in available CPU or memory and there is no difference in local disk access.
    You are using similar if not the exact same logic in your Java and Delphi programs.
    You have determined that Java ArrayList is not the cause of any slowdown.
    You have ruled out the majority of issues that I know of that would have a profound effect on performance. With this test case, as is, I would say that Delphi is in fact 10x faster then Java when doing this task.
    Having said that, it is very unusual for similar implementations to have this large of a performance discrepancy. Given similar circumstances, I personally would continue to research this because something of this magnitude is either a bug or a misunderstanding in the API. Unfortunately, in the test case as described, I don't have a trick that will increase Java / JDBC performance by 10x.
    That doesn't mean others in this forum cannot offer better consul, but given the information provided, I don't have much to offer.

  • MYSQL JDBC NoClassDefFoundError: org/aspectj/lang/Signature

    i am trying to connect to a database via java using JDBC i have installed:
    jdk1.5.0_01
    mysql-connector-java-3.1.8-bin-g.jar
    MySQL Server 4.1
    Java works fine, MYSQL works fine from the command prompt but when it comes to testing using this simple java program
    public class JdbcExample1 {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("localhost", "username", "password");
    if(!con.isClosed())
    System.out.println("Successfully connected to MySQL server...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(con != null)
    con.close();
    } catch(SQLException e) {}
    this compiles fine but when run i get the following error message
    Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at JdbcExample1.main(JdbcExample1.java:10)
    class path is set as .;C:\Program Files\Java\jdk1.5.0_01\jre\lib\ext\mysql-connector-java-3.1.8-bin.java
    any help or input on this error would be appreciated
    thanks in advanced Neil

    Hi, All:
    I just read this thread of discussion and got valueable info to solve my problem in a similar fashion. I'd suggest the last poster, Anil, to re-read the whole thread to correct the possible problems stated.
    I would just like to add my problem/solution scenario to this thread to share my experience. I assume that readers already went through the previous notes in this thread.
    #1. Space in Path:
    I installed
    MySQL DB server in: "C:\Program Files\MySQL\MySQL Server 4.1"
    MySQL JDBC Driver: D:\mysql\mysql-connector-java-3.1.8
    It seems to me that the DB server installed directory is not affected by whether there is a space in path name. The JDBC Driver path, on the other hand, does have the side effect of the space in path name when accessing by the Java client.
    #2. -g in JDBC Driver:
    I have been using the driver mysql-connector-java-3.1.8-bin.jar. However, right before I needed to create my ant build.xml configuration file (more details later), I thought the instruction asked me to use the mysql-connector-java-3.1.8-bin-g.jar (the debug version as kpreiser indicated), and therefore I got the now-well-known "org/aspectj/lang/Signature" error. After I removed that "-g" from the JDBC driver extression in my build.xml file, it then works well. (Great tip, kpreiser.)
    #3. Middlegen with Hibernate:
    My situation is a bit more complicated, but the issue of "org/aspectj/lang/Signature" error was the same (finally resolved in #2). I was trying to use Middlegen to re-generate my Hibernate map files from the data schema. (Hibernate is an open source tool that lets you create JavaBean source file from a Hibernate map file to map to a database table (see http://www.hibernate.org/ for more details.) Since I re-factored my data schema in the database, I needed to re-generate the Hibernate map files (from data schema) so that I can in turn use the map files to re-generate the JavaBean code. I wanted to use the Middlegen tool (see http://www.hibernate.org/98.html for more details) to re-generate the map files from database schema. However, in order to use Middlegen properly, you need to create the ant build.xml file to do that job. So I had to resort to MiddlegenIDE (see http://ultimania.org/middlegenide/ for more details) to help generate that build.xml file. (This is where I had the -g specified for the JDBC driver in the build.xml file that caused the problem.) Once that build.xml file is generated, the use of ant (a Java make tool) with the build.xml file can generate the hibernate map files. From these map files, JavaBean source files can be generated using Hibernate CodeGenerator.hbm2java tool. (There are several other useful tools in Hibernate too to convert the database ddl schema and the JavaBean source file.)
    Obviously, there are other approaches and tools that you can use (XDoclet for instance) for different situations, but I am only providing a high level overview on what you can do to be more productive if you are involved in a large and complicated project with Java/JDBC and ORM (Object/Relational Mapping).
    Item #3 may sound complicated at first, but it's worth the time to learn the tools and concept. Once you are familiar with these tools (Eclipse, Hibernate, Middlegen, Ant, etc.), you will become more productive in responding to the dynamic nature of the high-tech world where changing requirements are the only constant. I hope that these separate tools will become more integrated and easier to use in the future, but for now they do the job well.
    Thanks for the great tips and hope that this helps too.
    - Shuh

  • Connection mysql jdbc error ?

    I have program java likes this :
    import java.sql.*;
    public class LoadDriver {
        // Define the JDBC Driver and the database connection URL
        public static final String DRIVER = "com.mysql.jdbc.Driver";
        public static final String URL = "jdbc:mysql://localhost/java?user=test&password=test";
        public static void main(String args[]) {
            Connection conn = null;
    Statement select = null;
    ResultSet result = null;
            try {
                // load the driver dynamically
                Class.forName(DRIVER);
                // connect to the database
                conn = DriverManager.getConnection(URL);
                // perform a query. first create a Statement object from the connection
                select = conn.createStatement();
    // next execute a query (SQL string) and return the results in a ResultSet object
                result = select.executeQuery("select fname, lname from names order by lname, fname");
                // print out the results
                while(result.next()) {
                    String fname = result.getString("fname"); // note these match the columns in the
                    String lname = result.getString("lname"); // SELECT statement (fname, lname)
                    System.out.println(fname+" "+lname);
    // check if there was a problem executing the SQL statement
            catch (SQLException e) {
                System.err.println("SQL Exception: "+e.getMessage());
                System.exit(1);
    // if the JDBC driver is not in the CLASSPATH
            catch (ClassNotFoundException e) {
                System.err.println("Class not found:  "+e.getMessage());
                System.exit(1);
    // catch any other exceptions
            catch (Exception e) {
                System.err.println("Other Exception: ");
                System.err.println(e.getMessage());
                System.exit(1);
    // You want to close the connections no matter what happens!
    finally {
    try {
    // close the result, query, and database connection
    if (result != null) result.close();
                 if (select != null) select.close();
                if (conn != null) conn.close();
    catch (SQLException e) {
    // one of the new cases where it's OK to just eat exceptions or at the most log them
    System.err.println("Error closing connection: "+e.getMessage());
      but i get errror likes this :
    D:\Program Files\Java\jdk1.5.0_03\bin>javac LoadDriver.java
    D:\Program Files\Java\jdk1.5.0_03\bin>java LoadDriver
    Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Sign
    ature
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at LoadDriver.main(LoadDriver.java:20)
    D:\Program Files\Java\jdk1.5.0_03\bin>
    I place mysql.jar in
    - D:\Program Files\Java\jdk1.5.0_03\jre\lib\ext
    - D:\Program Files\Java\jdk1.5.0_03\lib
    - D:\Program Files\Java\jdk1.5.0_03\jre\lib
    and i make classpath to D:\Program Files\Java\jdk1.5.0_03\bin;D:\Program Files\Java\jdk1.5.0_03\jre\lib\ext\
    but it still doesn't work
    What must I do ?
    Thx 4 your reply

    Hello!
    I'm getting this same error message and i followed the code example as close as i could:
    Thanks for any help on this!
    bk
    set oldpath=%PATH%
    set JAVA_HOME=C:\jdk1.5.0_02
    set ANT_HOME=C:\ANT\apache-ant-1.6.5
    set PATH=C:\jdk1.5.0_02\bin;%ANT_HOME%\bin
    set CLASSPATH=.;C:\jdk1.5.0_02\lib;C:\MYSQL\mysql-connector-java-3.1.10\src\com\;C:\MYSQL\mysql-connector-java-3.1.10\src\org\;C:\MYSQL\mysql-connector-java-3.1.10\mysql-connector-java-3.1.10-bin-g.jar;
    http://www.developer.com/java/data/article.php/3417381#Critical_steps_in_using_JDBC
    import java.sql.*;
    public class Jdbc11 {
      public static void main(String args[]){
        System.out.println(
                      "Copyright 2004, R.G.Baldwin");
        try {
          Statement stmt;
          //Register the JDBC driver for MySQL.
          Class.forName("com.mysql.jdbc.Driver");
          //Define URL of database server for
          // database named mysql on the localhost
          // with the default port number 3306.
          String url =
                "jdbc:mysql://localhost:3306/mysql";
          //Get a connection to the database for a
          // user named root with a blank password.
          // This user is the default administrator
          // having full privileges to do anything.
          Connection con =
                         DriverManager.getConnection(
                                     url,"root", "");
          //Display URL and connection information
          System.out.println("URL: " + url);
          System.out.println("Connection: " + con);
          //Get a Statement object
          stmt = con.createStatement();
          //Create the new database
          stmt.executeUpdate(
                           "CREATE DATABASE JunkDB");
          //Register a new user named auser on the
          // database named JunkDB with a password
          // drowssap enabling several different
          // privileges.
          stmt.executeUpdate(
              "GRANT SELECT,INSERT,UPDATE,DELETE," +
              "CREATE,DROP " +
              "ON JunkDB.* TO 'auser'@'localhost' " +
              "IDENTIFIED BY 'drowssap';");
          con.close();
        }catch( Exception e ) {
          e.printStackTrace();
        }//end catch
      }//end main
    }//end class Jdbc11
    Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature

  • JDBC Adapter Issue

    Hi Experts,
    I have an issue with my XI JDBC adapter.  Once a job gets sent through XI (from nonSAP to XI to SAP), the JDBC adapter is required to write a confirmation in the database that the job was processed in SAP.
    When I go into my Adapter Monitor (http://system:num/AdapterFramework/) I see a red dot beside JDBC and the following error:
    Error: Transform error in xml processor class, rollback:
    ERROR:Processing request: Error when executing statement for table/stored proc. 'stfx.job_copy': com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed.
    Any ideas??

    Hi Bhavesh,
    I update with the XML coming out of XI.  All I need to update is the status.  This XML currently does come out of XI and would be sent back to my database, except for the fact that the JDBC adapter goes down, and I get the originally mentioned error.  The XML looks like:
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_UPDATE_STATUS xmlns:ns0="http://tssi.ycdsb.ca">
    - <STATEMENTNAME>
    - <dbTableName action="UPDATE">
      <TABLE>sfx.job_copy</TABLE>
    - <access>
      <status1>DONE</status1>
      <status2>DONE</status2>
      </access>
    - <key>
      <jobId>00595593</jobId>
      <status1>NEW</status1>
      <messagenm>d3e98e294bfcd2d5d3e98e29</messagenm>
      </key>
      </dbTableName>
      </STATEMENTNAME>
      </ns0:MT_UPDATE_STATUS>
    Any ideas?

  • Performance Issue in 8_1_7

    After upgrading from 8.1.6 to 8.1.7 both database and JDBC drivers I am facing a significant performance issues in AQ. getQueue() method takes arounf 2 minutes in 8.1.7 whereas it was taking just 19 seconds in 8.1.6. Can someone throw light on this. Thanks !!

    I got in this thread by searching for getQueue() performance topic. Producing stats for aq$_queues does work, and it improves performance by 50% when there are large number of queues. I think it can be further improved by looking into other tables used by getQueue(). Could you explain how's the sql statement issued by getQueue() look like ? The reason I'm asking this is based on the obersavtion we have after applying the stats of aq$_queues: Under one instance there are two users having queues, the 1st user has 4 queues, the 2nd users 400 queues; the getQueue() of 1st user is almost twice faster than that of the 2nd user.

  • Error in Class.forName("com.mysql.jdbc.driver")

    Hi forum,
    Please help me to solve the issue.
    im using the following jsp code for genrating the reports using JASPER REPORTS
    the JSP FILE
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="javax.sql.DataSource"%>
    <%@ page import="javax.naming.InitialContext"%>
    <%@ page import="net.sf.jasperreports.engine.*"%>
    <%@ page import="net.sf.jasperreports.engine.design.JasperDesign"%>
    <%@ page import="net.sf.jasperreports.engine.xml.JRXmlLoader"%>
    <%@ page import="net.sf.jasperreports.engine.export.*" %>
    <%@ page import ="net.sf.jasperreports.engine.*"%>
    <%@ page import ="net.sf.jasperreports.engine.JasperFillManager"%>
    <%@ page import ="net.sf.jasperreports.engine.JRException"%>
    <%@ page import="net.sf.jasperreports.engine.JasperReport"%>
    <%@ page import="net.sf.jasperreports.engine.JasperPrint"%>
    <html>
    <body bgcolor="00ffcc">
    <%
    try{
    Connection con = null;
    String url="jdbc:mysql://localhost/customer";
    String username = "root";
    String password = "cmsadmin";
    InputStream input=new FileInputStream(new File("C:/Documents and Settings/user/My Documents/NetBeansProjects/jasperreports/web/helloworld.xml"));
    JasperDesign design = JRXmlLoader.load(input);
    JasperReport report = JasperCompileManager.compileReport(design);
    Map params = new HashMap();
    params.put("reportTitle", "helloworld");
    params.put("author", "Muthu Kumar");
    params.put("startDate", (new java.util.Date()).toString());
    params.put("ReportTitle", "PDF JasperReport");
    <img class="emoticon" src="images/emoticons/confused.gif" border="0" alt="" />Class.forName("com.mysql.jdbc.Driver");<img class="emoticon" src="images/emoticons/confused.gif" border="0" alt="" /><img src="images/emoticons/confused.gif" border="0" alt="" />
    con = DriverManager.getConnection(url,username,password);
    JasperPrint print = JasperFillManager.fillReport(report, params, con);
    OutputStream output=new FileOutputStream(new File("C:/Documents and Settings/user/My Documents/NetBeansProjects/jasperreports/helloreportworld.pdf"));
    JasperExportManager.exportReportToPdfStream(print, output);
    // JasperViewer.viewReport(print);
    catch(SQLException es) {
    out.println(es);
    catch(JRException ex){
    //ex.printStackTrace();
    out.println(ex);
    %>
    </body>
    </html>The error it is saying is in the line Class.forName(....) ;
    Please look for the emoctions with question mark
    i DOn know what to do.
    Please help
    Im comparin the below JRXML file as with the above code
    <?xml version="1.0"?>
    <!DOCTYPE jasperReport
    PUBLIC "-//JasperReports//DTD Report Design//EN"
    "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
    <jasperReport name="helloworld">
    <parameter name="reportTitle" class="java.lang.String"/>
    <parameter name="author" class="java.lang.String"/>
    <parameter name="startDate" class="java.lang.String"/>
    <queryString>
    <![CDATA[SELECT * FROM customer order by UserID ]]>
    </queryString>
    <field name="UserID" class="java.lang.String"/>
    <field name="UserName" class="java.lang.String"/>
    <field name="City" class="java.lang.String"/>
    <field name="State" class="java.lang.String"/>
    <title>
    <band height="60">
    <textField>
    <reportElement x="0" y="10" width="500" height="40"/>
    <textElement textAlignment="Center">
    <font size="24"/>
    </textElement>
    <textFieldExpression class="java.lang.String">
    <![CDATA[$P{reportTitle}]]>
    </textFieldExpression>
    </textField>
    <textField>
    <reportElement x="0" y="40" width="500" height="20"/>
    <textElement textAlignment="Center"/>
    <textFieldExpression class="java.lang.String">
    <![CDATA["Run by: " + $P{author}
    + " on " + $P{startDate}]]>
    </textFieldExpression>
    </textField>
    </band>
    </title>
    <columnHeader>
    <band height="30">
    <rectangle>
    <reportElement x="0" y="0" width="500" height="25"/>
    <graphicElement/>
    </rectangle>
    <staticText>
    <reportElement x="5" y="5" width="50" height="15"/>
    <textElement/>
    <text><![CDATA[UserID]]></text>
    </staticText>
    <staticText>
    <reportElement x="55" y="5" width="150" height="15"/>
    <text><![CDATA[UserName]]></text>
    </staticText>
    <staticText>
    <reportElement x="205" y="5" width="255" height="15"/>
    <text><![CDATA[City, State]]></text>
    </staticText>
    </band>
    </columnHeader>
    <detail>
    <band height="20">
    <textField>
    <reportElement x="5" y="0" width="50" height="15"/>
    <textElement/>
    <textFieldExpression class="java.lang.String">
    <![CDATA[$F{UserID}]]>
    </textFieldExpression>
    </textField>
    <textField>
    <reportElement x="55" y="0" width="150" height="15"/>
    <textElement/>
    <textFieldExpression class="java.lang.String">
    <![CDATA[$F{UserName}]]>
    </textFieldExpression>
    </textField>
    <textField>
    <reportElement x="205" y="0" width="255" height="15"/>
    <textElement/>
    <textFieldExpression class="java.lang.String">
    <![CDATA[$F{City} + ", " + $F{State}]]>
    </textFieldExpression>
    </textField>
    </band>
    </detail>
    </jasperReport>

    Glass_Fish wrote:
    I have set the classpath in the environment variables in the my computer properties.The web container has it's own properties. The "system" classpath means absolutely nothing to it. Read your server's documentation.

  • MySQL JDBC & RMI

    I have been developing a project, in which I have a Remote Object(RMI) which returns a ResultSet object obtained by MySql JDBC(J-Connector).
    The problem is the ResultSet object does not implement the Serializable Interface so that it cannot be passed to the client site from the remote site through RMI. This is fine, I have other way of solving this, except it will reduce my performance quite a lot!
    Therefor, I am wondering how does MYSQL JDBC does this...
    I can run a client in one machine and a DB (say MySQL)on the other machine. Using JDBC to connect them, and I can get the ResultSet with no problem at all, this resultset is also remote somehow. My question is how does MYSQL JDBC handle this, so that the data get passed from one mechine to another, and the speed is really fast....
    An answer will be a great value to me. Thanks in advance...

    JDBC connects to the Database not to a Java RMI server. You cannot pass a ReultSet around like this. They retain a connection to the Database (usually) until all rows have been and then still (usually) until closed. For this reason alone, it would be impossible to pass around ResultSets in this manner, and I am sure there are other reasons.

  • Oracle 9i reading BLOB performance issues

    Windows XP Pro SP2
    JDK 1.5.0_05
    Oracle 9i
    Oracle Thin Driver for JDK 1.4 v.10.2.0.1.0
    DBCP v.1.2.1
    Spring v1.2.7 (I am using the JDBC template for convenience)
    I have run into serious performance issues reading BLOBs from Oracle using oracle's JDBC thin driver. I am not sure if it a constraint/mis-configuration with oracle or a JDBC problem.
    I am hoping that someone has some experience accessing multi-MB BLOBs under heavy volume.
    We are considering using Oracle 8 or 9 as a document repository. It will end up storing hundreds of thousands of PDFs that can be as large as 30 MBs. We don't have access to Oracle 10.
    TESTS
    I am running tests against Oracle 8 and 9 to simulate single and multi-threaded document access. Out goal is to get a sense of KBps throughput and BLOB data access contention.
    DATA
    There is a single test table with 100 rows. Each row has a PK id and a BLOB field. The blobs range in size from a few dozen KB to 12MB. They represent a valid sample of production data. The total data size is approx. 121 MBs.
    Single Threaded Test
    The test selects a single blob object at a time and then reads the contents of the blob's binary input stream in 2 KB chunks. At the end of the test, it will have accessed all 100 blobs and streamed all 121 MBs. The test harness is JUnit.
    8i Results: On 8i it starts and terminates successfully on a steady and reliable basis. The throughput hovers around 4.8 MBps.
    9i Results: Similar reliability to 8i. The throughput is about 30% better.
    Multi-Threaded Test
    The multi-threaded test uses the same "blob reader" functionality used in the single threaded test. However, it spawns 8 threads each running a separate "blob reader".
    8i Results: The tests successfully complete on a reliable basis. The aggregate throughput of all 8 threads is a bit more than 4.8 MBps.
    9i Results: Erratic. The tests were highly erratic on 9i. Threads would intermittently lock when accessing a BLOB's output stream. Sometimes they lock accessing data from the same row, othertimes it is distinct rows. The number and the timing of the thread "locks" is indeterminate. When the test completed successfully the aggregate throughput of the 8 threads was approx. 5.4 MBps.
    I would be more than happy to post code or the data model if that would help.
    Carlos

    Hi Murphy16,
    Try investigate where are the principal issues in your RAC system.
    Check:
    * Expensive SQL's;
    * Sorts in disks;
    * Wait Events;
    * Interconnect hardware issues;
    * Applications doing unnecessary manual LOCKs (SQL);
    * If SGA is adequatly sized (take care to not use of SWAP space "DISK");
    * Backup's and unnecessary jobs running at business time (Realocate this jobs and backups to night window or a less intensive work hour at database);
    * Rebuild indexes and identify tables that must be reorganized (fragmentation);
    * Verify another software consuming resources on your server;
    Please give us more info about your environment. The steps above are general, but you can use to guide u in basic performance issues.
    Regards,
    Rodrigo Mufalani
    http://mufalani.blogspot.com

  • Mm.mysql JDBC Driver and the WHERE clause

    Anybody has succesfully performed a MySQL/JDBC query in a JSP application using more than one variable in the WHERE clause?
    It works fine when I run queries with one fixed value assigned to a column and one variable assigned to the other column in the WHERE clause; but when I do it with more than one variable in the WHERE clause, it screws up throwing an error.
    I wonder if it is a code error, a syntax error or if it is something tricky about the mm.mysql JDBC Driver. Following is a section of the code and the error. The variables are s_description and s_status. I read some examples in a book but they use SQL Server. Thank you in advance for any information.
    CODE:
    <% String sqlStatement = "" ; %>
    <% String s_description = "Mexican Style Rice" ; %>
    <% String s_status = "available" ; %>
    <% java.sql.Statement stmt = con.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_UPDATABLE); %>
    <% java.sql.ResultSet rs ; %>
    <% sqlStatement = "SELECT code, description, status FROM products WHERE products.description =" + s_description + " AND products.status =" + s_status + ";" ;%>
    <% rs = stmt.executeQuery(sqlStatement); %>
    <% rs.beforeFirst(); %>
    <% while (rs.next()) { %>
    <% rs.updateString(3, "sold"); %>
    <% rs.updateRow(); %>
    <% }%>
    <% rs.close(); %>
    This is the ERROR it throws
    java.sql.SQLException: Column not found: Unknown column 'available' in 'where clause'
         at org.gjt.mm.mysql.MysqlIO.sendCommand(MysqlIO.java:497)
         at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(MysqlIO.java:550)
         at org.gjt.mm.mysql.MysqlIO.sqlQuery(MysqlIO.java:635)
         at org.gjt.mm.mysql.Connection.execSQL(Connection.java:882)
         at org.gjt.mm.mysql.Connection.execSQL(Connection.java:815)
         at org.gjt.mm.mysql.Statement.executeQuery(Statement.java:169)
         at org.gjt.mm.mysql.jdbc2.Statement.executeQuery(Statement.java:78)
         at pagecompile._GetFood_xjsp._jspService(_GetFood_xjsp.java:45)
         at com.newatlanta.servletexec.JSP10HttpJspPage.service(JSP10HttpJspPage.java:41)
         at com.newatlanta.servletexec.JSP10Servlet.service(JSP10Servlet.java:779)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.newatlanta.servletexec.ServletExec.CallServletService(ServletExec.java:1679)
         at com.newatlanta.servletexec.ServletExec.processServletRequest(ServletExec.java:1654)
         at com.newatlanta.servletexec.ServletExec.processServletAlias(ServletExec.java:1602)
         at com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1343)
         at com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1113)

    I think perhaps this sentence has problems:
    <% sqlStatement = "SELECT code, description, status FROM products WHERE products.description =" + s_description + " AND products.status =" + s_status + ";" ;%>
    You can
    <% sqlStatement = "SELECT code, description, status FROM products WHERE products.description ='" + s_description + "' AND products.status = '" + s_status + "'" ;%>
    You perhaps ignore the ���� when using String variable s_description and s_status.
    Hope this will help you. Good lucky!

  • XI performance issue

    Hello ,
    I am facing one XI performance issue. We are using PI 7.1 SP 7 on AIX 5.3 and Oracle 10.2.0.4
    I have testing a simple file to file scenario, every 0.09 second, PI pull one 1kb size file from AIX file system and process, PI works fine, the item in Queue I see in SMQ2 is normally 10 - 20.
    But someone has implemented their own Scenario, it ECC 6 send iDoc to PI, PI process and send to SQL Server 2000 by JDBC adapter, it also use Acknowledgment. They uses complicated mapping, normally takes up to 10 seconds.  The performance is bad,  items in Queue is about 1000+.
    I really don't understand what is the problem.

    Hello,
    Please find the links below... which may help you.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2016a0b1-1780-2b10-97bd-be3ac62214c7
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/8080a971-8c72-2b10-2a94-d33f31366c19
    Regards,
    Madhu

Maybe you are looking for

  • Could not use the Brush tool because there is not enough RAM? Photoshop CS6?

    That and I couldn't even save a project I was working because (There was not enough RAM) My computer is running Windows 7 with 4 (3 usable) GB Ram, Pentium Dual Core; @ 2.00 Ghz -I have allocated all possible RAM to CS6 -I set 6 scratch disks (the fi

  • New computer: Multiple iTunes accounts?

    I've just setup my family's brand new computer and it is now time to install iTunes. I am wondering if iTunes is able to detect and customize itself to separate windows users. Ideally, we would like each user to be able to create their own play-lists

  • Some websites fail to load page on safari

    Two websites, Twitter and my bank fail to load properly.  The page starts to load then hangs when the blus bar is about a quarter of the way across the address bar.  The fault is intermittant - sometimes the page loads fine - and it doesn't seem to b

  • Oracle Portal - 1 year on, how are we all doing?

    Hi all, I imagine it's been a busy year for all of you. We've now had Oracle Portal in place since December 2000. We've gone from 3.0.7.6.2 to 3.0.8.9.8 and now to 3.0.9.8.2. We've had an up hill struggle, with 9iAS and Portal bugs, instability of ou

  • Photoshop and Bridge occasionally freeze in original user account

    Thank you for the update Pietrogpazzi.  Are you only experiencing difficulties with Adobe Bridge and Photoshop in the original user account?