Home » Developer & Programmer » Forms » How to call a java function from Oracle forms?
How to call a java function from Oracle forms? [message #265148] Wed, 05 September 2007 09:45 Go to next message
kelvinora
Messages: 16
Registered: September 2007
Location: India
Junior Member
Hi
I am new to Oracle Forms..
I am having Oracle 9.2.0.1.0 client in my PC and jdk version is 1.6

I had configured below tools in my PC. (windows 2000)
I am having Oracle 9.2 with Oracle Developer Suite 10g (10.1.2.0.2)
which contains Oracle JDeveloper 10g (10.1.2.1) also.

How to call a java function from Oracle forms?
Can you give me the code samples and how to integrate those thing?

Thanks
Re: How to call a java function from Oracle forms? [message #265159 is a reply to message #265148] Wed, 05 September 2007 10:08 Go to previous messageGo to next message
Soumen Kamilya
Messages: 128
Registered: August 2007
Location: Kolkata
Senior Member

First go to the Program -> Import Java Classes./forum/fa/3003/0/
It will shows you the classes to import dialog box.
See the next post.
  • Attachment: java.bmp
    (Size: 827.35KB, Downloaded 16634 times)
Re: How to call a java function from Oracle forms? [message #265161 is a reply to message #265159] Wed, 05 September 2007 10:09 Go to previous messageGo to next message
Soumen Kamilya
Messages: 128
Registered: August 2007
Location: Kolkata
Senior Member

Now choose the class which you want to import.
It will imoprt the classes on Program Units section.
/forum/fa/3004/0/

Cheers
Soumen
  • Attachment: imported.bmp
    (Size: 1.12MB, Downloaded 16722 times)
Re: How to call a java function from Oracle forms? [message #265172 is a reply to message #265161] Wed, 05 September 2007 10:40 Go to previous messageGo to next message
kelvinora
Messages: 16
Registered: September 2007
Location: India
Junior Member
Hi Thanks for your screen shots..

After that what i can do?

How can i test it?

Thanks
Re: How to call a java function from Oracle forms? [message #265190 is a reply to message #265161] Wed, 05 September 2007 12:56 Go to previous messageGo to next message
Littlefoot
Messages: 21809
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
@Soumen Kamilya:

As you chose not to accept private messages, here it is: I've seen that you have posted a few screenshots in the Forms forum. That's fine as long as you keep them small in size; therefore, use JPG or PNG instead of BMP which is HUGE and opens very slowly.

For other useful suggestions, please, read the OraFAQ Forum Guide.
Re: How to call a java function from Oracle forms? [message #265351 is a reply to message #265148] Thu, 06 September 2007 02:57 Go to previous messageGo to next message
kelvinora
Messages: 16
Registered: September 2007
Location: India
Junior Member
Hi Thanks for ur sugesstions..

How can i proceed further ?

Thanks
Re: How to call a java function from Oracle forms? [message #265436 is a reply to message #265351] Thu, 06 September 2007 05:42 Go to previous messageGo to next message
Soumen Kamilya
Messages: 128
Registered: August 2007
Location: Kolkata
Senior Member

Littlefoot Thanks for the information.
Actually I was out of my mind while posting this screen shorts and forgot to convert it to JPG. In Further posts I'll not post .bmp format (Promise) Razz

Now to the Topic:

kelvinora, You can now call the java functions from any forms trigger as it is converted to PL/SQL Packages.
Just call them in your trigger and it will work fine.

Cheers
Soumen
Re: How to call a java function from Oracle forms? [message #265462 is a reply to message #265436] Thu, 06 September 2007 06:46 Go to previous messageGo to next message
kelvinora
Messages: 16
Registered: September 2007
Location: India
Junior Member
Hi thanks for your quick response
Can you give the Syntax for calling java functions in Oracle forms..

I had created one Module (FIRSTFRM) in forms,
there are many triggering events are there..
I choose key-f7..

----
The below is java code
package samples;

import java.sql.*;

public class DBTest {

public static String callDB(int id,String name){

String ss="Hai";
Connection con=null;

try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("connection url","userid","pwd");
Statement st=con.createStatement();
System.out.println("Connected...");
con.setAutoCommit(true);

int r=st.executeUpdate("Insert into FORM_TEST VALUES('"+id+"','"+name+"')");

if(r==1){
ss="Inserted";
}
else{
ss="Insertion Filed";
}
}catch(final Exception e){
System.out.println(e);
}
return ss;
}

public static void main(String[] args) {

int empid=102;
String empname="welocme";

String resultStr=callDB(empid,empname);
System.out.println(resultStr);

}

}

---
You had mentioned that call java functions from Trigger..
So i had opened the PL/SQL Editor...
Is it correct?
If correct means how to code in that?
How can i call this callDB() from forms?

Pls help
Re: How to call a java function from Oracle forms? [message #266427 is a reply to message #265462] Mon, 10 September 2007 21:28 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Do you have to use Java? What's wrong with PL/SQL? Have you considered storing the Java in the database as a procedure and then just calling that procedure from your Form?

I suggest going to the Oracle Forms website and reviewing the contents of the Java page which is referenced on it. Then download the Java examples and work through a couple.

David
Re: How to call a java function from Oracle forms? [message #388154 is a reply to message #265159] Mon, 23 February 2009 09:05 Go to previous messageGo to next message
waqasmadani
Messages: 1
Registered: August 2008
Location: Block 9, House 22-A, Stre...
Junior Member

I want to use Java bean using Oracle Forms 6i But I don't know that how to use. I use your given steps then this error raise.

"PDE-UJI001 Failed to create thr JVM."

What is it?
Re: How to call a java function from Oracle forms? [message #388499 is a reply to message #388154] Wed, 25 February 2009 00:55 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Google 'PDE-UJI001 Failed to create the JVM'. There are some goods threads. Remember to go to the BOTTOM of each thread to get the last response.

David
Re: How to call a java function from Oracle forms? [message #438973 is a reply to message #388499] Wed, 13 January 2010 05:28 Go to previous messageGo to next message
krish_hipl
Messages: 1
Registered: January 2010
Location: India
Junior Member
Hello,
I am facing the similar Issue as I created New form using Import Java Classes... and trying to call java code through "WHEN-BUTTON-PRESSED" Created on form. Code written on Trigger as below.

declare
		obj ORA_JAVA.JOBJECT;
		class_path varchar2(4000);
begin
	obj := FedexAddressValidationMain.New;
	class_path:= FedexAddressValidationMain.getClassPath;
	fnd_message.set_string(class_path);
	fnd_message.show;
		exception
			when ORA_JAVA.JAVA_ERROR then
					message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
			when others then
		  	fnd_message.set_string('Exception : '||SQLERRM);
		  	fnd_message.Show;
end;	

after deploying Form on application server, when the form is run from oracle application, i m getting following java exception-
"Unable to call out to Java".

I have followed the steps given above but still i m not able to fine the solution.Can anyone help me to explain the further steps that needs to be taken ahead.

Any help would be appriciated.

Thanks
Krishn..
[EDITED by DJM: applied [code] tags]

[Updated on: Wed, 13 January 2010 23:09] by Moderator

Report message to a moderator

Re: How to call a java function from Oracle forms? [message #521923 is a reply to message #265148] Sun, 04 September 2011 08:15 Go to previous messageGo to next message
roni_a180
Messages: 45
Registered: October 2007
Member
Hi
i am using Oracle Developer 6i and database oracle 8.1.7

How iam i using this option
Re: How to call a java function from Oracle forms? [message #541132 is a reply to message #521923] Fri, 27 January 2012 16:14 Go to previous message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
yes dear do as in images

  • Attachment: java.PNG
    (Size: 23.37KB, Downloaded 2283 times)
Previous Topic: Retrieving Long raw image
Next Topic: visual attribute
Goto Forum:
  


Current Time: Sat May 18 01:36:11 CDT 2024