How to call a java function from Oracle forms? [message #265148] |
Wed, 05 September 2007 09:45 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 #265462 is a reply to message #265436] |
Thu, 06 September 2007 06:46 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 #438973 is a reply to message #388499] |
Wed, 13 January 2010 05:28 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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
|
|
|
|
|