Invoke Java app from Oracle DB?
Hi
I wrote simple Java app I would like to deploy this class to Oracle DB server and to schedule execution, for example, every hour. I wonder how to do that.
Nenad
Nenad,
Although I have not done something like this myself, allow me to suggest the following resources that may help you (assuming you haven't already looked at them).
Excuse me, but I saw no mention of which Oracle database version you are using, so I have assumed it is 9i.
For loading java classes into the database, please refer to chapter 2 (Loading Java Classes) of the Java Stored Procedures Developer's Guide.
For scheduling periodic execution, use the DBMS_JOB (PL/SQL) package.
Good Luck,
Avi.
Similar Messages
-
Calling Java programs from Oracle Stored Procedure
Is it possible to call Java programs from Oracle stored procs? If possible Can this be used to exchange data from other applications? Is there a better method/feature in oracle for doing data exchange with other apps?
If what you mean by Oracle stored procedures is pl/sql then yes.
You can create a "wrapper" this way:
CREATE OR REPLACE FUNCTION xmlXform
in_mapUrl IN VARCHAR2,
in_inputUrl IN VARCHAR2
RETURN VARCHAR2
AS
LANGUAGE JAVA NAME
'com.yourcompany.xml2any.xform(java.lang.String,java.lang.String)
RETURN java.lang.String';
Then load the java as:
loadjava -user youruser/youruserpasswd -resolve -verbose lib/xmlparserv2.jar classes/com/yourcompany/xform.class classes/com/yourcompany/xml2any.class
The java, given the correct permissions, can do anything java can do including communicate with outside applications.
Is this the "best" way... depends on what you are trying to accomplish. -
Error: ORA-03113 while executing complex java code from Oracle PL/SQL
Hi,
I am trying to execute a complex java code from Oracle PL/SQL. The classes were resolved successfully. But in the middle of execution, I am getting the following error:
ERROR:
ORA-03114: not connected to ORACLE
begin
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 13685
Session ID: 21 Serial number: 20
Is there a way to debug the Java classes loaded into oracle? Or is there any utility to find out why the connection was lost?
Regards,
SaravanaHi Saravana:
You could use simply System.out.println(..) at your Java code and see the output at the .trc files generated for your Oracle session.
Or better than this adding Java Util Logging messages at your code, to see how to use JUL API at the OJVM please see this blog post [Using JUL API inside the OJVM|http://marceloochoa.blogspot.com/2007/11/getting-logging-entering-exiting-and.html].
Best regards, Marcelo.
PD: ora-0600 generally are associated with RDBMS bugs, but these bugs can be bypassed by replacing the code which throws the exception by other with a workaround. -
Dropping java object from Oracle 8i
We areaable to load java methods and publish them to SQL in Oracle 8i using Jdev Deploy wizard, but we can not drop them thru
Open View As->Database Browser of the connection object, they drop menu is greyed out/disable. What kind privilege we need to drop java object from Oracle 8i? Or there is something wrong with the database setup.
Thank you very muchThere are three options:
Normal
SysDBA
SysOper
I have tried the three of them, none of them works, is there third option SYS?
Thank you very much.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Amit:
Log in as SYS.<HR></BLOCKQUOTE>
null -
Invoking java methods from C/C++ on the machine with different JREs
I implemented Windows NT Service instantiating JVM and invoking several java methods. Everything works but I have an issue with running the service on the machine where multiple different versions of JRE have been installed. The service is calling java methods that require JRE 1.3 or later so I wrote the code that is setting system PATH from within the service based on the configuration stored in the external file. The problem is that the service requires jvm.dll to be in the PATH prior lunching it since this library is instantiated through the implicit linking. When I put jvm.dll in the same path as the service binary I can lunch it but JNI_CreateJavaVM fails and returns -1. This happens even if JRE 1.3 is in the system PATH prior lunching the service.
Everything works if the system PATH contains references to JRE 1.3 and jvm.dll is removed from the service's directory.
I am looking for an advice on what is the proper way to deal with invoking java methods from the C/C++ executable in the environment with different versions of JRE.
Thanks, Kris.Here's a way I have done what you are asking about:
What you want to do is make all of your linking happen at runtime, rather than at compile time. This way, you can edit the PATH variable before the jvm.dll gets loaded.
Following is some code that I used to handle a dll of my own in this manner. You can decide if you want to write a "wrapper" dll, or if you find it simpler to approach the jvm.dll in this way.
// Define pointer type for DLL entry point.
typedef void JREPDLL_API (*EXECUTEREQUEST)(char*, Arguments&);
// Set up path, load dll, and pass everything off to it.
HINSTANCE javaServer = javaServer = LoadLibrary("jrepdll.dll");
if (javaServer != NULL) {
EXECUTEREQUEST executeRequest = (EXECUTEREQUEST)GetProcAddress(javaServer, "ExecuteRequest");
if (executeRequest != NULL) {
if (argc == 1)
// Execute the request.
executeRequest("-run", args);
else
// Execute the request.
executeRequest("-console", args);
Here's some code for how to edit the PATH:
// Edit the PATH environment variable so that we use our private java.
char *appendPt;
char *newPath;
char *path;
char tmp[_MAX_PATH];
// Get the current PATH variable setting.
path = getenv("PATH");
// Allocate space for an edited path setting.
if (path != NULL)
newPath = (char*)malloc((_MAX_PATH * 2) + strlen(path));
else
newPath = (char*)malloc((_MAX_PATH * 2));
// Get upper part of path to desired directories.
strcpy(tmp, filepath);
appendPt = strstr(tmp, "dbin\\jreplicator");
appendPt[0] = '\0';
sprintf(newPath, "PATH=%sjava\\jre1.2.2\\bin;%sjava\\jre1.2.2\\bin\\classic", tmp, tmp);
// Append the value of the existing PATH environment variable.
// If there is anything, append it.
if (path != NULL) {
strcat(newPath, ";");
strncat(newPath, path, (sizeof(newPath) - strlen(newPath) - 2));
// Set new PATH value.
_putenv(newPath);
free(newPath); -
How to invoke crystal reports from Oracle forms 11g R2 along with passing p
How to invoke crystal reports from Oracle forms 11g R2 along with passing parameter to it.
how to pass parameters to crystal report, please help.how to pass parameters to crystal report, please help.This would entirely depend on crystal reports and you might find informations on crystal reports related communities more likely...I for one have seen crystal reports the last time about 12 years ago. And even back then I simply acknowledged it's existence instead of working with it.
Maybe crystal reports can be invoked via a URL call which would make it simple as you'd need simply build an URL and show the report using web.show_document. But that's pure speculation. Also you might not be the first with this requirement, so the solution to your problem might be right under your nose and just a little google search away ;)
cheers -
How to invoke java application from ABAP
How to invoke java application from ABAP ? Suppose I needto execute a EJB wihic is running on my SAP J2EE Enigne from an ABAP Program .
Thanks,
ManishHi Manish,
did you get some further documents concerning "abap program calls ejb"?
If yes, could you please send me some informations.
Thank you for your help.
Kind regards, Patrick. -
I have Flex running on Tomcat with LCDS. On tomcat there is a JAR that has classes I'd like to use/interact with from Flex. In the simple LCDS examples they demonstrate having a Product.java class and a matching Product.as class, but the java library I am trying to use has many more classes and would take a long time to copy into Actionscript.
What is the best way to interact with the Java classes (I don't have a web service to use like in the LCDS example).I only know we can use JNI to invoke native libraries
from Java and I have never used JNI to invoke Java
libraries from native applications (C/C++ programs).
I am going to look through the tutorial you
recommended.The last tutorial. I've only fiddled with it, as it was a bitch. If you don't need to use Suns JVM, I recomend using CNI & GCJ [ http://gcc.gnu.org/java/ ], as it is much neater.
Do you mean JNI is internally implemented by C++s
Runtime.exec method?Write a small Java application which invokes the lib you want, i.e. say you want to use Strings replaceAll method (simple example I know)
class Test {
pubilc static void main( String args[] ) {
System.out.println( args[0].replaceAll( args[1], args[2] ) ) ;
}Then use c++ program to run "/path/to/java Test tast a e" . -
Hi Guys,
I am calling java bean from oracle Forms6i (implementation
class property set to bean class). This java bean in turn
calling some JNI methods written in C. The application server
(Forms6i) is hanging at the point of calling the JNI method.
Is oracle Forms6i supports all java functionality (JNI here)
and if so how to solve the problem ?
Any pointers or tips in this regard is highly appreciated ?
Thanks & Regards
Chandra MohanTo call Java from forms:
look at the technical documents on Java integration at
http://otn.oracle.com/products/forms
and also look at the Javabeans and PJC samples in the sample
code section of Forms on OTN.
Creating a random number using a java class is an excelent
example of how to use Java with forms. -
Java 2013-004 versus Java 7 from Oracle
Back when Apple annoucned it would no longer update Java, I followed suggestions to install Java directly from Oracle. (Not sure of the version then, but the installation is now current on version 7.x running on OS X 10.7.5.) However, software update continues to offer updates for Java from Apple, most recently Java 2013-004. Why? What should be done about this?
So it's fine to have them both installed?
Yes. They do different things.
Can you provide any links that go into this distinction further?
java.com and the Apple Support downloads page. -
Trigger a Java method from Oracle
Does anyone know how I can trigger a java method from Oracle?
I have a certain Java method in my application which I want to be executed everytime a new record is added to a certain table.
In Oracle I could use a trigger on insert but what can I do if I want a Java method to be executed after a new record was inserted? Does anyone know that?
Thanks for your helpMy application is already running, it does not have
to get started, I just need a method to be called
from Oracle.well unless oracle is running some sort of java listener in your vm i can't see it being possible.
either poll for the change, or become incharge of the change, or using the external command system. -
Invoke Java library from C/C++
Hello everyone,
Are there any approaches to invoke Java libraries from C/C++?
Thanks in advance,
GeorgeI only know we can use JNI to invoke native libraries
from Java and I have never used JNI to invoke Java
libraries from native applications (C/C++ programs).
I am going to look through the tutorial you
recommended.The last tutorial. I've only fiddled with it, as it was a bitch. If you don't need to use Suns JVM, I recomend using CNI & GCJ [ http://gcc.gnu.org/java/ ], as it is much neater.
Do you mean JNI is internally implemented by C++s
Runtime.exec method?Write a small Java application which invokes the lib you want, i.e. say you want to use Strings replaceAll method (simple example I know)
class Test {
pubilc static void main( String args[] ) {
System.out.println( args[0].replaceAll( args[1], args[2] ) ) ;
}Then use c++ program to run "/path/to/java Test tast a e" . -
Installing Java 7 from Oracle just made Applets not work, how to fix
Mac 10.7.4. I tried installing Java 7 from Oracle, but all it did was remove half the prefs from Java and make Applets not work. How do I revert/reinstall Java?
Here you go!
Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
I am employed by HP -
How to invoke a Java Program from Oracle 10g?(uRGENT)
Hello.
I've a query, that i have a program, that basically retreives the records from the
oracle table and then parser this information and then insert the values in corresponding database base tables. I want that, whenever the new program is inserted, a Trigger should fire and pass the most recently entered record to the Parser Program, means
1) Firing a Trigge
2)Storing the most latest data and pass it to the Parser PROGRAM
Can someone tell me how to do this? How to invoke a Java Program from within the database? Please if anyone has examples provide me. Its very urgent and tell me what is the basic mechanism.
Thankyou.
BenWith Java Stored Procedures Java may be caleed from a database.
http://www.oracle.com/technology/tech/java/jsp/index.html -
Error Invoking Java class from Stored proc
We are getting this error while calling a stored procedure that invokes a
static function of a java class from inside Oracle 8.1.7.
ORA-29516: Aurora assertion failure: Java thread deadlock detected
ORA-06512: at "APPS.SERVICECONSUMERINVOKE", line 0
ORA-06512: at line 40
In a Toad SQL Window, when I execute the stored procedure that invokes the
java function, it executes successfully on the first attempt. When I try to
execute it again on the same SQL Window, it gives the above error. The java
class is part of a package and indirectly makes a JMS request-reply call
via other helper classes.
The same package works fine from other web containers and
unlike the Oracle JVM Aurora, the JVMs don't detect a deadlock.
Why does the Aurora throw an error?Did you try issusing a commit and then trying again in Toad SQL Window?
The advice is to contact support:
ORA-29516: Aurora assertion failure: string
Cause: An internal error occurred in the Aurora module.
Action: Contact Oracle Worldwide Support.
Maybe you are looking for
-
Searching for a Certain iPhone App on Apple iTunes AppStore???
ok i need to know if Apple AppStore has an iPhone App that Detects Rats & Mice??? why i ask??? Last night I Was Sleeping in My Room ok so there are times I Get up in the middile of the night & Have Very Bad Habits of Rocking back & Fourth at night so
-
Loading CLOB data to a flat file in owb 11.2.0.3
Hi, Also,I have one more question.I want to load a table with clob data into a flat file using my owb client 11.2.0.3.But when I run this simple mapping ,I am getting this error: ORA-06502:pl/sql:NUMERIC OR VALUE ERROR:CHARACTER STRING BUFFER TOO SMA
-
Hi All, I have a report which if i run in background is giving me dump.I am getting tsv_tnew_blocks_no_roll_memory error.I checked in debugging and am pasting the code where it is failing Fetching delivery history SELECT ebel
-
The home button on my iPhone 4 doesn't work
The home button on my iPhone 4 does not work. Any suggestions?
-
Can't start J2EE server :o(
Hi, I'm getting started with J2EE but I can't start the J2EE server. I have to point out that I read the instructions in J2EE Tutorial 1.3 but I use J2EE SDK 1.4 Beta.. But it should work, shouldn't it??? I don't expect the problem to be very serious