Java Compiler - Java Compiler ?

Hi,

I have converted my DELPHI 5 program (which copies data from Lotus Notes

databases into Oracle tables) into a Java program, developed in Eclipse 3.1.

I am TOTALLY new to Java, but the program is now running inside of Eclipse.

The PROBLEM IS that my DELPHI program can read a Lotus Notes db

of 27400 records and load it into the Oracle table in 3 minutes.

The Java program takes 25 minutes.

The logic is the same in both programs.

I am GUESSING that Eclipse is compiling my code into ".class" files, which

is bytecode and is being 'interpreted' as it executes within Eclipse?

And I need to find ANOTHER compiler to produce

machine code to make this run faster and also to run this machine

code outside of Eclipse?Is this correct?

Could this be the reason this program is running SO slowly?

Right now, this program will be running on my XP workstation.

Hopefully soon, it will sit on the Notes (unix solaris) server.

Any insight, ideas would be greatly appreciated.

thanks

p

[1096 byte] By [pablito46a] at [2007-11-26 23:06:42]
# 1
I am guessing that the programs aren't equivalent at all. Obviously Java can do this task in the same kind of time that Delphi can.
ejpa at 2007-7-10 14:00:26 > top of Java-index,Developer Tools,Java Compiler...
# 2

Or there are external conditions that are different.

If the Delphi program is running on another machine with a far faster connection to the Notes server it is sure to be faster.

If the JDBC (I guess) driver for Notes that's being used is no good that might be the bottleneck.

If the Java program performs tons of logging and the Delphi program logs nothing there's a potential big performance difference right there.

Or maybe you're doing your read operations wrong. If the Delphi program reads data in large blocks and the Java program uses small blocks that's another performance hit, especially if it also opens and closes the connection for each read operation (don't laugh, I've sadly seen things like that).

Maybe they're using different protocols (direct database access versus http access for example)...

jwentinga at 2007-7-10 14:00:26 > top of Java-index,Developer Tools,Java Compiler...
# 3

My first guess would be that your JDBC connection to the Oracle database has "auto commit" turned on.

So that for every insert statement, it commits to the database.

I'd try turning auto commit on the connection, and manually calling connection.commit() say every 100 records.

You can experiment to find the optimum number of records to commit after, eg.

50, 100, 200, 500, 1000 etc.

regards,

Owen

omcgoverna at 2007-7-10 14:00:26 > top of Java-index,Developer Tools,Java Compiler...
# 4

The Delphi program is running on a Win 2000 machine at my

desk, 523,280 KB Ram, Pentium, 4 CPU, 1.80GHz .

Connects to Oracle through the Oracle Client software that is installed

on this Win 2000 machine.

The Java program is running on a Win XP machine at my desk,

504 MB Ram, Pentium, 4 CPU, 3.20 GHz.

Connects to Oracle using JDBC, whose classes I imported into Elclipse

from the same Oracle Client software installed on the XP machine.

Neither have a faster connection to Notes.Both programs create Notes

objects to create Notes Sessions, create the Notes DB object, get the

Notes view from that object, get the Notes document collection, loop

through Notes documents, etc., generate INSERT statements for the

Oracle part.

I'll have to check to see whether large blocks or small, as you mentioned.

I don't think that I am opening and closing the connection with each read,

but I'll check on that also.

thanks

p

pablito46a at 2007-7-10 14:00:26 > top of Java-index,Developer Tools,Java Compiler...
# 5
Yes. This is probably true.I think that autocommit is the default, yes?So, it is on.I'll fix that and try it again.Thanksp
pablito46a at 2007-7-10 14:00:26 > top of Java-index,Developer Tools,Java Compiler...
# 6
Correction:The Delphi program executes in 7(not 3) minutes to read 27400 records froma Notes database and insert to Oracle.The Java program executes in 25 minutes to do the same work.p
pablito46a at 2007-7-10 14:00:26 > top of Java-index,Developer Tools,Java Compiler...
# 7

run the thing through a profiler, or insert some logging statements to get timing for every step of the process.

See WHERE the bottleneck is, as it is you're grasping at straws which is unlikely to help you get more than marginal improvements unless you by chance stumble upon something important.

In my experience, if a Java program talking to an external service is slow it's usually either the drivers that talk to that service (or the way they're configured), that external service, or the network.

As you say the network and external service are not slow (as is apparent from the higher performance of your Delphi application which you say does the same thing several times faster) it's likely the code you're using to access Notes from Java that's slow.

But without timing information you're not going to know for certain, let alone know which lines are the problem.

Until you know that you're not going to be able to successfully and deliberately tackle your problem.

jwentinga at 2007-7-10 14:00:26 > top of Java-index,Developer Tools,Java Compiler...