Home » SQL & PL/SQL » SQL & PL/SQL » How does Java fit into PL/SQL-Oracle? (Java)
How does Java fit into PL/SQL-Oracle? [message #402445] Sun, 10 May 2009 09:29 Go to next message
JenFromNY
Messages: 10
Registered: May 2009
Junior Member
I know this is a vague but I only have limited information and I was hoping someone here could help me. I am somewhat familiar with PL/SQL and I know a bit of Java programming but I've never used them together. I understand that in Oracle databases, Java may be used in conjunction with PL/SQL -- perhaps Java might be used to display/trigger some error/output related to a botched database insert?. But how exactly is does the Java language work with Oracle and PL/SQL? And is it the normal Java programming language or Javascript that is used? Could someone please give me a quick and simple overview or provide a link to a tutorial? A few simple sets of Java/Oracle-PL/SQL instructions and commands would be greatly appreciated. Thx.
Re: How does Java fit into PL/SQL-Oracle? [message #402446 is a reply to message #402445] Sun, 10 May 2009 09:39 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10672
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Just Google. This was the first hit.
http://www.dbasupport.com/oracle/ora10g/JavaOracle.shtml

Apart from using JDBC, you can just write a java program and load it into an Oracle database as-is and "call" it inside Oracle routines.
One of the less used features of Oracle is the support it provides for Objected Oriented Concepts.
I personally think the Oracle Syntax for Objects is main factor for this not getting much used (way different from Java / C++ Syntax and is very confusing).

[Updated on: Sun, 10 May 2009 09:43]

Report message to a moderator

Re: How does Java fit into PL/SQL-Oracle? [message #402447 is a reply to message #402445] Sun, 10 May 2009 09:44 Go to previous messageGo to next message
BlackSwan
Messages: 25037
Registered: January 2009
Location: SoCal
Senior Member
http://www.lmgtfy.com/?q=oracle+java+pl/sql+demo

http://asktom.oracle.com
contains many fine coding examples

You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
More help please on "How does Java fit into PL/SQL-Oracle?" [message #402553 is a reply to message #402445] Mon, 11 May 2009 08:02 Go to previous messageGo to next message
JenFromNY
Messages: 10
Registered: May 2009
Junior Member
Sorry but not all of the links provided in your replies were unbroken or understandable to me...a novice. I am not a developer, just someone who will interact with an Oracle database in a very basic way to run some select queries and to get the details when, say, a file with invalid characters comes and triggers an error. Somehow Java is used to output this error so the bad file can be detected and rectified...I believe a stcktrace of some kind might be inviolved. This is where I need some very basic guidance. Java, as I have dealt with it in the past, requires its code to be compiled via javac. Would you really need to compile your code every time you use Java within an Oracle database for issues such as the one I described above? This doesn't seem right to me. Could it be a Javascript of some kind that is used? Is there anyone who can step thru, in a very basic way, what the process would be? Thx.

[Updated on: Mon, 11 May 2009 08:59]

Report message to a moderator

Re: More help please on "How does Java fit into PL/SQL-Oracle?" [message #402580 is a reply to message #402553] Mon, 11 May 2009 10:11 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Basically there could be 2 completely different scenarios:

1) There could be a separate Java program that is interacting with the DB via the JDBC driver, and that is generating the errors you see, or ...

2) there could be Java stored procedures INSIDE the Oracle database which are generating the errors you see.

Those would be two completely different things, which would require completely different approaches.

Can you find out which one of the two is the case in your system?

Re: More help please on "How does Java fit into PL/SQL-Oracle?" [message #402590 is a reply to message #402580] Mon, 11 May 2009 10:39 Go to previous messageGo to next message
JenFromNY
Messages: 10
Registered: May 2009
Junior Member
I really can't say. All I know is that when a third party sends their data file to "us", it can generate an error if the file contains invalid characters. Somehow, some way, JAVA is used by us to see the error and, I assume, determine what/where the bad character is. An Oracle DB with PL/SQL is involved. I just don't want to walk into this issue totally clueless...just need enough info to get started on learning the basics. Is there a way with Java you can submit an uncompiled command to see a stack trace or error log?...I'm guessing this is more or less what may be involved here. But I'm totally guessing because I have never been exposed to this before.
Re: More help please on "How does Java fit into PL/SQL-Oracle?" [message #402604 is a reply to message #402590] Mon, 11 May 2009 11:02 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
In both scenarios you can't send any un-compiled Java commands.

There is either compiled Java bytecode on the filesystem, or compiled Java bytecode in the Oracle stored Java procedure.

You CAN send un-compiled PL/SQL Code from an external Java program to be executed on the database on the other hand.

But, as I said 1) and 2) would be basically two different cases, so it would also be two completely different basics you would have to start learning. So better find out which case it it, first.

A possible starting point for case 1 would be here

A possible starting point for case 2 would be here, especially the "Java Stored Procedure" example.


Re: More help please on "How does Java fit into PL/SQL-Oracle?" [message #402614 is a reply to message #402604] Mon, 11 May 2009 11:55 Go to previous message
JenFromNY
Messages: 10
Registered: May 2009
Junior Member
OK--I'm guessing it may be a stored procedure since the scenario I described is pretty common and surely they don't reinvent the wheel each time it happens. I'll read up on it. Thx for your assistance!
Previous Topic: Half the query using index and remaining not.
Next Topic: dynamic column_name in cursor
Goto Forum:
  


Current Time: Mon Dec 05 08:33:39 CST 2016

Total time taken to generate the page: 0.16520 seconds