Home » Developer & Programmer » JDeveloper, Java & XML » Native Java in Oracle vs PL/SQL
Native Java in Oracle vs PL/SQL [message #521175] Fri, 26 August 2011 13:20 Go to next message
manubatham20
Messages: 307
Registered: September 2010
Location: Noida, India
Senior Member

Hi,

I just came to know that we can you java code natively with Oracle. But I didn't get the situation, how to decide when to use native java in oracle and when to use pl/sql.

Do you guys have any idea about that? Please suggest me any tutorial from where I can get the required information.

Thanks,
Manu
Re: Native Java in Oracle vs PL/SQL [message #521181 is a reply to message #521175] Fri, 26 August 2011 13:40 Go to previous messageGo to next message
Michel Cadot
Messages: 54247
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Only when you cannot do something in PL/SQL.

Following T. Kyte's SQL Mantra:

1. Do it in a single SQL statement if at all possible.
2. If you cannot, then do it in PL/SQL (as little PL/SQL as possible!).
3. If you cannot do it in PL/SQL, try a Java Stored Procedure (extremely rarely necessary with Oracle9i and above).
4. If you cannot do it in Java, do it in a C external procedure (when raw speed, or 3rd party API written in C is needed).
5. If you cannot do it in a C external routine, you might want to seriously think.


Regards
Michel
Re: Native Java in Oracle vs PL/SQL [message #521187 is a reply to message #521181] Fri, 26 August 2011 13:47 Go to previous messageGo to next message
manubatham20
Messages: 307
Registered: September 2010
Location: Noida, India
Senior Member

Smile

Nice explanation.

May I get any source, from which I come to know, for which things I need to move on Java and C, while having PL/SQL. What are the limitations of PL/SQL that can be done only in Java or C.

Actually I need some test cases. With my little experience I am not able to think when I should move for Java and C natively.

Thanks,
Manu
Re: Native Java in Oracle vs PL/SQL [message #521201 is a reply to message #521187] Fri, 26 August 2011 14:33 Go to previous messageGo to next message
Michel Cadot
Messages: 54247
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
As Tom said, it is now rare, before there was no package to send mail or access internet within the database, so you have to use Java classes for this. Now this is embedded in some standard PL/SQL packages.
I use Java only to get some system parameters of the database server (System.getProperties), for the moment there is no oequivalent in PL/SQL.
There is no doc on this, just "if you can't do it in one way then go to the next one" rule.
So it depends on your Oracle version and imagination.

Regards
Michel
Re: Native Java in Oracle vs PL/SQL [message #522343 is a reply to message #521201] Thu, 08 September 2011 14:21 Go to previous messageGo to next message
msol25
Messages: 211
Registered: June 2011
Location: Mumbai
Senior Member
Hi Manu,

You can call pl/sql code using shell script(.sh file) in your javascript code(using javascript built in packages HTP and HTD).If you need to call pl/sql using javascript then you need to maintain copy of your shell script in cgi-bin directory.

You can find cgi-bin directory location:


  find / -name cgi-bin




Re: Native Java in Oracle vs PL/SQL [message #522346 is a reply to message #522343] Thu, 08 September 2011 14:38 Go to previous message
Michel Cadot
Messages: 54247
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What has the question to do with Javascript and shell and...?
Who talks about 3-tier architecture?
YOu are completly out of topic.

Regards
Michel
Previous Topic: difference among gettransaction,getdbtransaction and getoadbtransaction
Next Topic: Loading and processing XML file at run time
Goto Forum:
  


Current Time: Sat May 25 16:25:44 CDT 2013

Total time taken to generate the page: 0.61606 seconds