Home » Developer & Programmer » JDeveloper, Java & XML » How to write a Java code in oracle (Oracle 9i,XP)
How to write a Java code in oracle [message #382336] Thu, 22 January 2009 00:03 Go to next message
rakeshramm
Messages: 170
Registered: September 2006
Location: Oracle4u.com
Senior Member

How to write a Java code in oracle using create Java.


Thanks in Advance
Re: How to write a Java code in oracle [message #382338 is a reply to message #382336] Thu, 22 January 2009 00:06 Go to previous messageGo to next message
BlackSwan
Messages: 22783
Registered: January 2009
Senior Member
>How to write a Java code in oracle using create Java.
HUH?

Java is platform independent source code.
Java does not "know" anything about Oracle.

What problem are you really trying to solve?

You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you & please be consistent & correct in your postings.




Re: How to write a Java code in oracle [message #382341 is a reply to message #382336] Thu, 22 January 2009 00:13 Go to previous messageGo to next message
wmgonzalbo
Messages: 97
Registered: November 2008
Member
Not clear, but you mean like this..?

CREATE AND RESOLVE JAVA SOURCE NAMED "MyClass" AS
import java.io.*;
import java.sql.*;

public class MyClass
{
public static void getList(String directory)
                   throws SQLException
{
    File path = new File( directory );
.
.
.

}

}



before anything else be sure you won't get this error message..

ORA-29538: Java not installed


Regards,
Wilbert

[Updated on: Thu, 22 January 2009 00:14]

Report message to a moderator

Re: How to write a Java code in oracle [message #382343 is a reply to message #382338] Thu, 22 January 2009 00:14 Go to previous messageGo to next message
rakeshramm
Messages: 170
Registered: September 2006
Location: Oracle4u.com
Senior Member


After compiling this code in oracle .how can i execute it from pl/sql

CREATE JAVA SOURCE NAMED "Hello" AS
   public class Hello {
      public static String hello() {
         return "Hello World";   } };
Re: How to write a Java code in oracle [message #382345 is a reply to message #382343] Thu, 22 January 2009 00:17 Go to previous messageGo to next message
rakeshramm
Messages: 170
Registered: September 2006
Location: Oracle4u.com
Senior Member

Yes Willbert i really mean it will u give me a simple example



Thanks Willbert thanks
Re: How to write a Java code in oracle [message #382348 is a reply to message #382336] Thu, 22 January 2009 00:20 Go to previous messageGo to next message
wmgonzalbo
Messages: 97
Registered: November 2008
Member
Try something like this.. Based from my previous sample.


CREATE PROCEDURE MainMyClass( p_directory varchar2 )
as language java
name 'MyClass.getList( java.lang.String )';



Refer to other online references for more info.

EDIT: Procedure name.

Regards,
Wilbert

[Updated on: Thu, 22 January 2009 00:22]

Report message to a moderator

Re: How to write a Java code in oracle [message #382361 is a reply to message #382336] Thu, 22 January 2009 00:48 Go to previous message
Michel Cadot
Messages: 59093
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
All docs are on http://tahiti.oracle.com including example of what you asked.
Sample codes are on Oracle Technology Newtwork.

Regards
Michel
Previous Topic: I get a SQLException, when trying to connect to oracle
Next Topic: How to parse xml using plsql
Goto Forum:
  


Current Time: Wed Sep 17 02:35:44 CDT 2014

Total time taken to generate the page: 0.11257 seconds