Problem in running a java stored procedure&optimum settings for this needed
hi
we are using java stored procedures to read huge data from database tables and transfer them to another system.
the procedure is running fine but it fails after transferring 60000 records, the execution of procedure here does not terminate but keeps running with out performing any data transfer....since it does not give any error it is difficult for us to know what the actual problem is !!!!!!
i have checked the code many a time and i dont see any infinite loops in that code.
please give any pointers on why this might be happening?
please also give all the parameters which need to be taken care of while running a java stored procedure
thanks
regards
asif
But the same thing works fine with a jdbc program
the table name is converted
The same convert.transform method is being used to do the conversion
please help
ISQL is similar to SQL prompt inOracle
it is like,
ISQL>
Regards
khurram
Similar Messages
-
Java Stored Procedure Deployment Problem with JDev 3.1.1.2
Dear JDeveloper Team:
I am having a problem deploying a test Java stored procedure to the database. In the Deployment Profile Wizard Connection tab, it displays no connection in the connection dropdown even though I have defined some connections that have been sucessfully connected to the database.
Please help.
Thanks,
TomTom,
Verify that your Connections are valid as follows:
Double Click on the Connections folder of JDeveloper Navigator.
This opens up the Connection Manager.
Make sure you have defined JDBC Connections.
Pick your connection of intrest and select Edit... and then press the Test button to test the conneciton.
If this is a valid JDBC connection, then it should appear later when you run the deployment wizard.
-John -
Java stored procedure vs. PL-SQL vs. external java program
Hi,
I'm using a stored procedure for running a query and a few consequent updates. Currently I'm using Java stored procedure for that, which was my choice for simplicity on one hand, and running with the DB on the other.
In my tests, strangely enough it came out that running as java stored procedure was 3-4 times slower than running as a java program outside the database. I don't know how to explain this, and I wonder if switching to PL/SQL will improve the performance of the code.
Any experiences? recommendations?
Thanks,
DawgIn my tests, strangely enough it came out that running as java stored procedure was 3-4 times slower than running as a java program outside the database. I don't know how to explain this, and I wonder if switching to PL/SQL will improve the performance of the code.This isn't strange at all. See: Oracle's JVM (Aurora) is an independent Java Virtual Machine implementation, in accordance to specification. It implements all necessary parts of it (I think so). When you use an external JVM (I assume it's Sun's HotSpot JVM) you use completely different product. It is implemented in different way, it has many different code parts.
One of the biggest differences between Oracle's JVM and Sun's JVM is [Just-in-Time compiler|http://en.wikipedia.org/wiki/Just-in-time_compilation]. Oracle has implemented it only in the 11g version of database, i.e. 2 years ago, while Sun performed it back in 2000 and continues to improve it for the last 9 years. That would explain obvious differences between Java program inside and outside the DB: they are executed in absolutely different worlds. Diffs could be up to 10x times or more - that's not unusual.
If you are on 10g and want to compare performance of stored Java procedure vs external program, then you might use additional command-line instruction for external program to disable JIT:
-XintPS. I wouldn't use Java for your task - that's a total overkill. Use simple SP instead. -
8i Lite and Java Stored Procedure
Has anyone had success running the Java
Stored Procedure examples with 8i LIte.
My SQLPLus window alwways dies when the demo sql script triest to attach the stored procedure to the table.
The line causing error is:
++++++++++++++++++++++++++++++++++++++++++
alter table inventory attach java source "Oracle.lite.INVENTORY" in '.'
with constructor args(PID,QTY,THRESHOLD);
+++++++++++++++++++++++++++++++++++++++++++
I am using Sun JDK1.3 on Windows2000.
Any help will be highly appreciated.
nullFound the issue. jvm.dll was not in the path.
Bhaven
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Bhaven Avalani ([email protected]):
Has anyone had success running the Java
Stored Procedure examples with 8i LIte.
My SQLPLus window alwways dies when the demo sql script triest to attach the stored procedure to the table.
The line causing error is:
++++++++++++++++++++++++++++++++++++++++++
alter table inventory attach java source "Oracle.lite.INVENTORY" in '.'
with constructor args(PID,QTY,THRESHOLD);
+++++++++++++++++++++++++++++++++++++++++++
I am using Sun JDK1.3 on Windows2000.
Any help will be highly appreciated.
<HR></BLOCKQUOTE>
null -
Java Stored Procedure functions in SQL DML - multiple invocations
When running a java stored procedure as part of a DML statement the procedure is invoked 10-15 times for each row that is updated.
For example:
Update mytable set mycolumn = myjsp(somecolumn);
I undertand that this was a known bug with the JDBC driver. Has it been fixed? Is there a workaround?
We are using 8.1.6 on NT 4
Thanks
JulianHello ,
I tried here, and it seems to call the function once for each row
eg :
package package90;
public class Class1 extends Object {
public int get_data(int i)
return i+10;
Published the get_data function as
myproject67.get_data
SQL> connect scott/tiger@orcl8i
Connected.
SQL> set serveroutput on
SQL> exec dbms_java.set_output(5000);
PL/SQL procedure successfully completed.
SQL> select * from test_java;
NO1
10
10
SQL> insert into test_java values (20);
1 row created.
SQL> select * from test_java;
NO1
10
10
20
SQL> update test_java set no1=myproject67.get_data(no1);
Called
Called
Called
3 rows updated.
SQL> select * from test_java;
NO1
20
20
30
SQL> -
Calling JPA from a Java Stored Procedure
Is it possible to call JPA from a java stored procedure? If so, does anyone have example? How do you setup the persistence.xml?
How does the peformance compare with straight JDBC in a java stored procedure?
Thanks for any help!
JohnnyHi Johnny:
Basically you can run any JDK 1.5 framework inside your Oracle 11g JVM, I have experience integrating Lucene IR library as a new [Domain Index for Oracle 11g/10g|http://docs.google.com/View?id=ddgw7sjp_54fgj9kg] .
I am not familiar with JPA internals but my advice is howto handle the connection inside the OJVM and the configuration files.
Some time ago I took a look to SpringFramework integration and I found that writing a new ApplicationContext class which handles the loading of beans.xml from XMLDB repository instead a file should be enough to work.
Another important point is the life cycle of the [Oracle internal JVM|http://download.oracle.com/docs/cd/E11882_01/java.112/e10588/chtwo.htm#BABHGJFI]. Unlike an standard JVM the OJVM is created once you first connect from the middle tier at OCI level and remains in execution during the connection pool existence.
I mean, if you connect using a JDBC pool the JVM will remains running across multiple soft open/close connections of your middle tier application. This is good because you can read your persistence.xml file using a Singleton class and this expensive operation will be re-used by multiple open/close operation done from the middle tier.
I suggest you do a simple Proof of Concept with a Hello World application and check if it works.
Remember that any security issues will be notified to the .trc files, security issues are related to the strong security layer configured by default inside the OJVM, for example you can not read any files from the OS file system without an specific grant, you need another grant to access to the class loader and so on, but you can simply grant this specific needs to a database role and then grant this role to the user which connect to the OJVM.
Another important point is related to the [End-of-Call Optimization|http://download.oracle.com/docs/cd/E11882_01/java.112/e10588/chtwo.htm#BABIFAAI] this can be useful if you want to perform some clean up in your Singleton class at the level of per-statement execution.
Best regards, Marcelo -
How may one increase JVM/Java Stored Procedure Perfomance?
Hi all,
my question: How can one increase the performance of the Oracle JVM, especially of Java Stored Procedures?
I ask this because I did some performance analysis (and was horrified :):
I have a static Java method that'll need an average 15 ms to return - when executed locally.
The same code, uploaded to an Oracle10g instance and published as Java Stored Procedure will take awful *925 ms*.
I measured both times from within the method as shown below:
public class JSProc {
public static void doSomething() {
long start = System.currentTimeMillis();
// now comes the '15 ms'-code
long time = System.currentTimeMillis() - start;
That way, I'm not including any call spec overhead, network communication or whatever into the 925 ms. All in all the above procedure call will take about 1200 to 1500 ms until it returns to the client...
The hardware: both client/server computers have the same hardware, both use the JDK provided with the latest Oracle10g release; single difference: client is Win2K, server is Linux.
I would be immensely grateful for your suggestions concerning the possibilities to increase the JVM performance...
Greetings,
SamAs Avi suggested, subsequent calls of the procedure within the same session will reduce the execution time down to 40 ms in my testing environment.
But that doesn't change anything for the 'first call' - when I start a new client program that opens a new connection, the Java Stored Proc will again need about a second to return.
I wrote the procedure now in PL/SQL - it will return in less than 30 ms, subsequent calls will return in less than a ms. Guess what I'll use :)
I played around with the JAVA* configuration params, but, as expected, that doesn't change anything in terms of performance. According to documentation, it will only affect the amount of classes I can load into the server.
I just read that Oracle creates a new "little" JVM for every session, and I imagine that there's lot of method intercepting and things (the ominous AOP-code) to ensure transaction security.
That's why I come to the conclusion that I won't use Java Stored Procedures for classical "connect, execute, disconnect" client-server applications. It's like full braking on the freeway :) -
Problem of java stored procedure
hi,
now I use the oracle9i JDeveloper9.0.3.1 to develop java stored procedure and then publish it to oracle9i database.
In the database I create PL/SQL procedure to invoke the java stored procedure.But I encounter the problem,that is ,when I run the PL/SQL procedure ,it throw the java.lang.NullPointerException ,while the java class,the java stored procedure can run correctly invoked by the main class of java.The code of the java stored procedure is as follows:
import java.sql.*;
import java.util.Properties;
public class SQLServerEventDistribute
public static void sqlServerSaveData(String hostName,String databaseName,String user,String password,String tableName,int x1,int y1,int x2,int y2,String ip)
String url="",sql="",userName="",passwd="";
Connection connection;
Statement statement;
url="jdbc:microsoft:sqlserver://"+hostName+":1433;DatabaseName="+databaseName+";User="+user+";Password="+password;
sql="INSERT INTO "+tableName+" VALUES("+x1+","+y1+","+x2+","+y2+",'"+ip+"')";
Properties property=new Properties();
property.setProperty(userName,user);
property.setProperty(passwd,password);
try
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
// DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
connection=DriverManager.getConnection(url,property);
statement=connection.createStatement();
statement.execute(sql);
}catch(ClassNotFoundException connectSQLServerEx)
System.out.println(connectSQLServerEx.getMessage());
catch(SQLException connectSQLServerEx)
System.out.println(connectSQLServerEx.getMessage()+connectSQLServerEx.getErrorCode());
the main class is as follows:
public class Test
public static void main(String[] args)
SQLServerEventDistribute.sqlServerSaveData("gsm","gsmd","sa","sa","IPBinding",11,45,24,21,"23.1.248.12");
and the PL/SQL procedure is as follows:
PROCEDURE TEST AS
BEGIN
SQLSERVERSAVEDATA('gsm','gsmd','sa','sa','IPBinding',11,45,24,21,'23.1.248.22');
END;
How can I deal with it?
can you tell me?
thanksHi JavaQQ,
This is just a guess, but I think you need to load the
Micro$oft SQLServer JDBC driver into the Oracle
database (using the "loadjava" utility).
In any case, there are several ways -- apart from JDBC
-- for accessing a different database from within an
Oracle database. Have you tried searching the Oracle
Web sites for suitable products?
Hope this helps.
Good Luck,
Avi.abramia ,thank you very much.
but I have load the Microsoft SQLServer JDBC driver into the Oracle database .
When I debugged the PL/SQL procedure,the exception was thrown at line connection=DriverManager.getConnection(url,property);
What's the problem with it? -
DBMS_JOB on Java Stored Procedure problem
Hi all,
(running on Oracle 9i : 9.2.0.7.0 64bit on HP/UX)
I have a Java Stored procedure that reads a table
One of the fields in this table is a CLOB containing some more SQL.
We then executeQuery() that SQL (and e-mail the output).
(Obviously I also have PL/SQL wrapper around it, which we'll call PROCNAME).
For certain pieces of SQL, this second executeQuery() fails throwing ORA-00942, but only when run from a DBMS_JOB(!).
Calling "CALL PROCNAME('argument')" from sqlplus/toad works fine, but setting "PROCNAME('argument')" to run as a DBMS Job fails on some SQL with the above error. (All as the same username).
java.lang.StackTraceElement doesn't seem to exist in Oracle java, so the only error I have to go on is e.getMessage() from SQLExecption which returns:
ORA-00942: table or view does not exist
Any help at this strangeness would be appreciated!
nicHi Cris:
May be is a problem of the effective user which is running the procedure.
Which is the auth_id directive at the PLSQL call spec?
Look at this example procedure UploadNews for example:
http://dbprism.cvs.sourceforge.net/dbprism/cms-2.1/db/cmsPlSqlCode.sql?revision=1.21&view=markup
this procedure calls to the cmsNews.doImport which is implemented as Java Stored Procedure.
Also check if your loadjava operation is not using -definer flag.
Best regards, Marcelo. -
Running a Corba Client as a Java Stored Procedure
Hi,
I�m trying to use a Java Stored Procedure running as a Corba Client. I want to use the built in Visibroker ORB on Oracle side and JacORB (or others) on the server side.
How can I init the ORB and get a naming service running not in Oracle but on the server side? Also which jar�s do I need to load into the db with (loadjava) to run the visibroker orb inside the Java Stored Procedure Client?
I�m using Oracle 8.1.7.
Thanks for help ;)By the way I�m using ORACLE 8.1.7.
-
Problem passing REF CURSOR to JAVA STORED PROCEDURE
Hi,
I've written a small Java class with a static method and
imported that into Oracle 8i. The method expects a
java.sql.ResultSet object as parameter. According to the
documentation of Oracle, a REF CURSOR (cursor variable) maps to
java.sql.ResultSet in JDBC.
The definition of the Java Stored Procedure was accepted without
problems:
CREATE OR REPLACE PROCEDURE RESULTSETPASSINGTESTPROC (row
WASTypes.GenericCurType)
as language java
name 'sqlj.ResultSetPassingTest.testResultSetPassing
(java.sql.ResultSet)';
WASTypes is a package containing the definition of the generic
cursor:
CREATE OR REPLACE PACKAGE WASTYPES
is
TYPE GenericCurType IS REF CURSOR;
END WASTypes;
In a function I'm opening the cursor via
'Open cursorVariable for sqlStatement';
Then this cursor variable is passed to the java method and the
error ORA-03113 is shown.
I tried to solve the problem by changing the type of the
parameter to oracle.sql.REF without success.
Does anybody know what wents wrong?
Thanks in advance.
JanHi,
I've written a small Java class with a static method and
imported that into Oracle 8i. The method expects a
java.sql.ResultSet object as parameter. According to the
documentation of Oracle, a REF CURSOR (cursor variable) maps to
java.sql.ResultSet in JDBC.
The definition of the Java Stored Procedure was accepted without
problems:
CREATE OR REPLACE PROCEDURE RESULTSETPASSINGTESTPROC (row
WASTypes.GenericCurType)
as language java
name 'sqlj.ResultSetPassingTest.testResultSetPassing
(java.sql.ResultSet)';
WASTypes is a package containing the definition of the generic
cursor:
CREATE OR REPLACE PACKAGE WASTYPES
is
TYPE GenericCurType IS REF CURSOR;
END WASTypes;
In a function I'm opening the cursor via
'Open cursorVariable for sqlStatement';
Then this cursor variable is passed to the java method and the
error ORA-03113 is shown.
I tried to solve the problem by changing the type of the
parameter to oracle.sql.REF without success.
Does anybody know what wents wrong?
Thanks in advance.
Jan -
Re Java Stored Procedure Problem
Ben
There appear to be some problem with the forum. It doesn't want to show my response to your post with the subject "Java Stored Procedure Problem". See the answer to this thread for an example of how to do this...
Is there a SAX parser with PL/SQL??Ben
There appear to be some problem with the forum. It doesn't want to show my response to your post with the subject "Java Stored Procedure Problem". See the answer to this thread for an example of how to do this...
Is there a SAX parser with PL/SQL?? -
Performance problem with java stored procedure
hi,
i developped a java class, then I stored it in Oracle 8.1.7.
This class contains several import of other classes stored in the database.
It works, but the execution perfomances are disappointing. It's very long. I guess, that's because of the great number of classes to load that are necessary for my class execution.
I tried to increase the size of the java pool (I parameter 70 Mo in the java_pool_size parameter of the init.ora), but the performance is not much better.
Has anyone an idea to increase the performance of this execution of my class ?
In particular, is there a way to keep permanently in memory the java objects used by my class ?
Thanks in advance
bye
[email protected]
nullbefore running Java, the database session needs to be Java enabled; this might be the reason why it is taking so long. If this is the case, you should see an improvement in subsequent calls, once a database session is Java enabled, other users can benefit from it.
Kuassi
I have some performance issue with java stored procedure. Hope some one will be able to help me out. I'm using java stored procedures in my application and basically these procedures are used to do some validation and form the XML message of the database tables. I have noticed that when I call the PL/SQL wrapper function, it is taking time to load the java class and once the class is loaded the execution is faster. Most of the time is spent for loading the class rather than executing the function. if I reduce the class load time, I can improve the performance drastically. Do any one of you know how to reduce the class load time. The following are the platform and oracle version.
O/S: IBM AIX
Oracle: 8.1.7 -
Java stored procedure problem(oracle db)
HI,
we have a java stored procedure with the following definition, and that works as we want it to:
CREATE OR REPLACE FUNCTION processBulletin(in_varchar VARCHAR2) RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'JavaParser.Bufr_Ingest.processBulletin(java.lang.String) return java.lang.String';
And the Java portion:
public static String processBulletin(String in_bull)
... do something with in_bull
The problem is that we've recently discovered that the 32767 size restiriction on the input parameter varchar2 is too small. I don't want to rewrite the entire Java procedure. I figured the simplest (or at least temporary)solution would be to have the Java procedure accept a CLOB, convert that clob to a string and continue as it would. I was hoping someone might be able to tell me if the following would be possible:
CREATE OR REPLACE FUNCTION processBulletin(in_clob CLOB) RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'JavaParser.Bufr_Ingest.processBulletin(oracle.sql.CLOB) return java.lang.String';
And the Java portion:
public static String processBulletin(oracle.sql.CLOB in_clob)
String in_bull = clob_in.getSubString(1, (int)clob_in.length());
... do something with in_bull
ThanksI don't know about Java stored procedures, but in JDBC you usually use streams to work with CLOBS. Here's Oracle JDBC Developers Guide, Working with LOBs
-
Problem In creating Java stored procedure- Urgent
Hi Guys,
I try to create a simple Java stored procedure but I get the following error message. Can you help me to sort out the problem please?.
SQL> create or replace and compile java source named "Hello"
2 as
3 public class Hello {
4 public static String hello()
5 {
6 return "Hello Oracle World";
7 }
8 }
9 /
Warning: Java created with compilation errors.
SQL> show error java source Hello;
No errors.
Thanks in advance
anthony
nullI had a similar issue, the reason for that was picking the incorrect partner link.
Make sure the name of the selected partner link in the invoke output variable is matching with the Assign, in you case lets say you mapped the
Invoke
output variable is invoke_1_CallStoredProcedure_OutputVariable ( not nvoke_1_CallStoredProcedure_OutputVariable_1)
From
<Invoke_1_CallStoredProcedure_OutputVariable>
<LF_STATUS>
To
P_lf_status ( variable)
most of the time multiple variables are created when we try to select the output variable s in the Invoke.
Maybe you are looking for
-
I cant activate my iphone 3gs after upgrade to 5.1.1
i cant activate my iphone 3gs after upgrade to 5.1.1
-
All day events are given the time 00:00 when syncing with iPod.
I recently switched from syncing with a Palm m515 to syncing my calendars and contacts with an iPod. The first time I synced, all the untimed (all day) events in my iCal became timed events, with the time set at 00:00. Is there anything I can do to r
-
More Guru Winners for February 2015 in the WPF category and many others!
It's been a busy week that also saw the TECHNET WIKI SUMMIT 2015 Then we had the results for February's TechNet Guru competition ALSO posted! http://blogs.technet.com/b/wikininjas/archive/2015/03/19/technet-guru-february-2015.aspx Below is a summary
-
Taking Video "snapshots" on my Mac
Hello, I was looking around for an answer, but was uncertain as to how I should word the question and Didn't find any posts pertaining. So I will try my best to ask what I mean. Is it possible to record video of my computer activity. In other words,
-
HP Photosmart 5520 only printing black
I have a new Photosmart 5520, loaded with new HP cartridges. The ink colour levels are showing as fine, but it will not print in colour, only black. Have tried with various PCs. Test sheet and copying also comes out mono.