EJB from stored procedure lookup problem
We are running a test case with in an EJB deployed to Oracle 8.1.6, accessing it from a Java stored procedure. It works okay if the stored procedure is called a limited number of times from a single client (client is non-Java). However, for performance testing, we are trying to run it several hundred times in sequence to better simulate the eventual production environment. Consistently on the 216th call, it fails with a NamingException from the InitialContext lookup. We can restart the client again and it will fail on the same call.
Sounds like something memory related to me. Does anyone have any ideas? I'm using standard EJB client code in my stored procedure, instantiating an InitialContext, performing a lookup on the EJB, performing a home interface create, then accessing an EJB method.
Thinking it might be that my test was too fast for whatever garbage collection is being done on the server, I tried a 2 second delay between invocations--same problem occurs, however. Should I be making a call to remove my EJBs when my stored procedure ends? If so, how would I do that?
I did try making the handle to my EJB a static variable within the stored procedure and only "creating" the EJB once. That works okay with a single client, but if I run 2 clients simultaneously, 1 will work for awhile and then eventually die trying to call the EJB method--while the other client continues to run successfully.
I'm stumped. Any insight or guidance will be greatly appreciated. Thanks.
My DBA bumped up the large_pool_size and java_pool_size settings and the problem went away. I couldn't convince him to bump the settings one at a time, so am not sure which one was at the root of the problem.
As I looked at the trace logs on the server, I also noticed that we were getting intermittent "peer disconnected socket" messages during the testing. That appears to have gone away with the pool size increases, also--in case that helps out anyone else.
Similar Messages
-
Problem with execute SSIS package from stored procedure
Hi,
I would like to execute SSIS package from stored procedure. Therefore, I implemented sp which exec SSISDB.CATALOG.CREATE_EXECUTION method. When I try to test it from SSMS on remote server, I got error that
I was able to solve by adding “WITH EXECUTE AS …”. Then I got another error: The server principal "Domain\user" is not able to access the database "SSISDB" under the current security context. On Internet, I found a couple post that describe
how to access SSIS catalog (one of them by Ke Yang -
http://blogs.msdn.com/b/mattm/archive/2012/03/20/ssis-catalog-access-control-tips.aspx). It didn’t help. I’m still getting the error message.
How to debug this issue?
Any suggestion?
Thanks
SQL Server 2014 BISSMS does not propagate user credentials thus the error
Arthur
MyBlog
Twitter -
Returning rowcount and resultset from stored procedure
Hello,
In SQL Server you can return multiple resultsets from stored procedure by simple SELECT statement. But in Oracle, you have to use SYS_REFCURSOR.
Sample code:
CREATE OR REPLACE PROCEDURE sp_resultset_test IS
t_recordset OUT SYS_REFCURSOR
BEGIN
OPEN t_recordset FOR
SELECT * FROM EMPLOYEE;
END sp_resultset_test;
Is there any other way in Oracle 10 or 11 ?
Thank You.What is the requirement? Oracle is far more flexible than SQL-Server... with numerous features that do not exist in SQL-Server. (Fact)
One of the biggest mistakes you can make is to treat Oracle like SQL-Server... trying to match feature A1 in SQL-Server to feature B3 in Oracle.
Does not work that way.. rather then stick to SQL-Server as SQL-Server does SQL-Server specific features far better than Oracle.
So instead of trying to map what a T-SQL stored proc to do to an Oracle ref cursor (even to the extent of using that very silly sp_ prefix to name the proc), tell us the problem and requirements... That way we can tell you what Oracle features and options are best used to solve that problem - instead of competing in some unknown feature comparison event with SQL-Server. -
URGENT : Return Bulk data from Stored Procedure
Hi,
Tell me, how do I return a bulk of data which
does not exist in the data base
but is concluded while the Stored Procedure is executed
from the Stored procedure
to the C++ program.
For Example:
Table ABC
Field1 Field2 Field3
A 1 3
B 1 5
C 2 10
Table DEF
Field1 Field2 Field3
D 10 24
E 3 16
F 8 19
SP_TESTING
Depending on the values in both the tables
for some range of conditions,
a conclusion X is derived for each range value of the
condition range.
Now I need to return this bulk of data X with the
condition they belong to
back to the C++ code calling it....
NOTE : A stored procedure is requited as there is a lot
of processing
required before we conclude the result X for each value
in the condition range.
If I execute this code from C++ instead of Stored
procedure
it is very slow and speed is a prime requirement of my
system.
Also i'm not using any MFC class to access database.
I'm using ConnectionPtr, RecordsetPtr and _CommandPtr
from msado15.dll for database access...
One solution to this could be use of Temp tables.
As this process is used by a lot of different stored
procedures having a common
temp table to all will need something like 50 NUMERIC
fields, 50 VARCHAR fields
and so on, which doesn't seem like a very good solution
to this problem.
Sounds like something I would have done while in school,
implement a dumb solution.
So, please suggest me a solution as to how do I return
bulk data in the form
of recordsets from stored procedure.
Regards
ShrutiUse Out parameter mode
SQL> CREATE OR REPLACE procedure a1 (x OUT NUMBER, y OUT NUMBER) AS
2 BEGIN
3 x:= 1;
4 y:= 2;
5 END;
6 .
SQL> /
Procedure created.
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 a NUMBER :=3;
3 b NUMBER :=4;
4 BEGIN
5 a1 (a,b);
6 DBMS_OUTPUT.PUT_LINE( 'a = ' || a );
7 dbms_output.put_line( 'b = ' || b );
8 END;
9 .
SQL> /
a = 1
b = 2
PL/SQL procedure successfully completed.By default parameters are copied to the OUT parameter mode .
COPY hint in PLSQL don’t send a pointer to calling program unit but NOCOPY
does.
Khurram -
How to generate a report from stored procedure
I would like to generate a report from stored procedure.
I used to work on sql server. this can be done as easy as put a select statement at the end of stored procedure.
The resule can be displayed on the development IDE, like sql developer or consume by Java JDBC client.
is there equivalent way to do this in Oracle stored procedure?Hi,
What type of report you are looking..for.. ??
As you said that "I used to work on sql server. this can be done as easy as put a select statement at the end of stored procedure. "
When you execute it will return the result set and you will display directly on the FrontEnd.. Is my Understanding is correct Up to here.
See, In oracle you have call some custom stored procedures as you did in SQL Sever, but you have return the Results Sets, with help of Out put paramter, Either Cursors or Varrays..
or Else you can generate the Html reports based on your requirement, HTML can be used in the stored procedures of Oracle which will generate for your, you need to code it.
I could not able get the relevant link for your reference.
I will get back to you on this.
- Pavan Kumar N -
Calling DTS package from Stored Procedure
I am getting error calling DTS package from CF.
So i want to call DTS package from SQL Server Stored
Procedure.
DTS package create text file. So no need of input or output
parameter.
What is the syntax?.
thanks for ur help.Ted Kruger explains how this can be done in his blog post
Run SSIS Package from Stored Procedure
For every expert, there is an equal and opposite expert. - Becker's Law
My blog -
Best method to transfer large strings (XML data) to/from stored procedure
Hi!
I'm trying to call a PL/SQL procedure from Java. The procedure inputs a string (XML) that is parsed, and returns a result string (also XML).
Typical size of the string is 5kb -> 1mb.
I can see two possible solutions:
1) String / LONG
2) CLOB (Using DMBS_LOB.createTemporary and getting a CLOB locator and passing the locator to the stored procedure)
Does anyone have other suggestions?
What is the fastest method for transferring XML structures from to and from stored procedures?
AndersAnders,
I would say it depends on your requirement. Both the methods have some advantages and disadvantages.
Using a CLOB means that you have to use vendor specific libraries but this is more extendible and I fast too.
Using String/Long will be more portable in the long run but again you lose on speed/performance.
Just a doubt of mine... If I got it correct, you are transforming one XML to another XML based on some conditions. Why dont you use XSL and XSL StyleSheet Processor packaged with XDK for this? I think this would be the fastest way.
Hope this helps. -
System command execution from stored procedure
Hello World,
How to run System command from stored procedure ?
For example :
Delete a file
running a programm,
Is it possible ?
H.MYears ago I did this by writing an output file with commands into a directory and had a cron job looking for this file. At the end of the run the file was removed.
Never checked if there are other possibilities nowadays.
cu
Andreas -
Issue with Executing OS commands from Stored Procedure
I am trying to execute the scripts provided at :
http://github.com/xtender/XT_SHELL
provided by xtender user.
As required, I have asked my DBAs to grant privileges by executing the following scripts:
Begin
--change to needed permissions and execute
dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/factiva/ODS/bin/CVIM_Rpt_ExportCSVFile’, 'read,write,execute' );
end;
/where CVIM_Rpt_ExportCSVFile is my script residing in the Unix server where my Oracle is installed.
The error I am facing when I try to execute the following command is:
select * from table(xt_shell.shell_exec('/var/scripts/CVIM_Rpt_ExportCSVFile',100))
Exception:the Permission (java.io.FilePermission /var/scripts/CVIM_Rpt_ExportCSVFile execute) has not been granted to ODS. The PL/SQL to grant this is dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )I have asked my DBA to also execute the following scripts: - But I still see the same error as above. I am not able to figure out whats going on. Can anyone pls help me out??
EXEC Dbms_Java.Grant_Permission('ODS', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
EXEC Dbms_Java.Grant_Permission(ODS', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )DUPLICATE
===============================================================
Issue with Executing OS commands from Stored Procedure
============================================================== -
Ora-06550 returning data from Stored Procedure and Entity Data Model
Hi.
I'm creating an application that uses a WCF Service to return data. I also created a proyect with the EDMX design and mapped most of my DBModel to a classes context. I have added some of the procedures as well. One of them receive some parameters and return a Sys_RefCursor, that is populated according to the parameters.
I have declared the "<add >" tags in the Web.Config and imported the function of the Procedure. When I call the Asyncronous function I get different exceptions:
1. If I call the function, with all of the parameters i get:
Oracle.DataAccess.Client.OracleException: ORA-06550: línea 1, columna 8:
PLS-00306: número o tipos de argumentos erróneos al llamar a
'SP_HECHOSJURITER'
ORA-06550: línea 1, columna 8:
(wrong number or types of arguments in call to 'SP_HECHOSJURITER')
2. If i just set 1 parameter in the SP, returning the same type of data, I get:
Error al recibir la respuesta HTTP a
http://localhost/Procalculo.CGFM.SIGOC.DatosServices/ServiceDatos.svc.
(failed to receive http response. error 12152)
3. If I don't set any parameters in the procedure, it works fine, and return correct data.
It exclusively happen with one entity.
Any clue?
I appreciate any help.When you return result sets from stored procedures to Entity Framework, you are very likely using implicit result sets. Implicit result sets don't need to be declared as a parameter in code, only in the <add> tags to define the metadata in the .NET config file.
For example, in the EF Oracle By Example, you'll see that the stored procedure in the function import has three parameters, but only two are declared in the code. The third one was defined in the config file.
http://download.oracle.com/oll/obe/EntityFrameworkOBE/EntityFrameworkOBE.htm -
Returning SQL cursor from Stored Procedure
Hi,
I have a query regarding returning sql cursor from stored procedure to java in oracle 11g.
I want to query some data ex: my query returns A, B, C. Also, now I want to query some other data ex: D, E, F. Now I want to return this data as an sql cursor as a single row . Example: A,B,C,D,E,F. Is it possible to return/create a cursor in stored procedure?
assume both query returns equal number of rows.. however both are not related to each other..RP wrote:
Hi,
I have a query regarding returning sql cursor from stored procedure to java in oracle 11g.
I want to query some data ex: my query returns A, B, C. Also, now I want to query some other data ex: D, E, F. Now I want to return this data as an sql cursor as a single row . Example: A,B,C,D,E,F. Is it possible to return/create a cursor in stored procedure?
assume both query returns equal number of rows.. however both are not related to each other..It sounds like what you need is a ref cursor.
First thing to remember though is that cursors do not hold any data (see: {thread:id=886365})
In it's simplest form you would be creating a procedure along these lines...
SQL> create or replace procedure get_data(p_sql in varchar2, p_rc out sys_refcursor) is
2 begin
3 open p_rc for p_sql;
4 end;
5 /
Procedure created.
SQL> var rc refcursor;
SQL> exec get_data('select empno, ename, deptno from emp', :rc);
PL/SQL procedure successfully completed.
SQL> print rc;
EMPNO ENAME DEPTNO
7369 SMITH 20
7499 ALLEN 30
7521 WARD 30
7566 JONES 20
7654 MARTIN 30
7698 BLAKE 30
7782 CLARK 10
7788 SCOTT 20
7839 KING 10
7844 TURNER 30
7876 ADAMS 20
7900 JAMES 30
7902 FORD 20
7934 MILLER 10
14 rows selected.
SQL> exec get_data('select deptno, dname from dept', :rc);
PL/SQL procedure successfully completed.
SQL> print rc
DEPTNO DNAME
10 ACCOUNTING
20 RESEARCH
30 SALES
40 OPERATIONS
50 IT SUPPORTWhich takes an SQL statement (as you said that both your queries were unrelated), and returns a ref cursor, and then your Java code would fetch the data using that cursor.
Now, as for getting your rows to columns and combining two queries that do that... something along these lines...
SQL> select * from x;
C
A
B
C
SQL> select * from y;
C
D
E
F
SQL> ed
Wrote file afiedt.buf
1 select x.col1, x.col2, x.col3
2 ,y.col1 as col4
3 ,y.col2 as col5
4 ,y.col3 as col6
5 from (
6 select max(decode(rn,1,col1)) as col1
7 ,max(decode(rn,2,col1)) as col2
8 ,max(decode(rn,3,col1)) as col3
9 from (select col1, rownum rn from (select * from x order by col1))
10 ) x
11 cross join
12 (
13 select max(decode(rn,1,col1)) as col1
14 ,max(decode(rn,2,col1)) as col2
15 ,max(decode(rn,3,col1)) as col3
16 from (select col1, rownum rn from (select * from y order by col1))
17* ) y
SQL> /
C C C C C C
A B C D E F... will do what you ask. For further information about turning rows to columns read the FAQ: {message:id=9360005} -
Triggers accepting parametes from stored procedures
Can triggers accept parameters from stored procedures like some filename or column name of a table and pass them to external c procedures.If so I would greatly appreciate if any one could provide me with an example.
P.S The trigger is on a view and the view which in turn should be created in the stored procedure.
Thanks
HariniHello,
Yes you can invoke Web Services from the database, it is often called "Database Web Service call out" and it is documented in the Web Services Developer Guide
Regards
Tugdual Grall -
How to execute Operating System commands from Stored procedure.
Any help on how to execute Operating System commands from stored procedures will be appreciated.
Nanditha.Search the forums for 'External Procedure' and you will find example code that has been posted before.
-
Problem while running the report from stored procedure
Hi,
I using stored procedure to generate my report.
my stored procedure's code looks like this.
CREATE OR REPLACE PROCEDURE PROJECTOVERVIEWREPORT1(query in VARCHAR2)
IS
myPlist SRW_PARAMLIST;
myIdent SRW.Job_Ident;
myStatus SRW.Status_Record;
BEGIN
srw.start_Debugging;
myPlist := SRW_PARAMLIST(SRW_PARAMETER('',''));
srw.add_parameter(myPlist,'GATEWAY','http://localhost:8888/reports/rwservlet');
srw.add_parameter(myPlist,'SERVER','rep_kalyan1');
srw.add_parameter(myPlist,'REPORT','BillFormat.RDF');
srw.add_parameter(myPlist,'USERID','atl3_dev_jul04/atl3_dev_jul04@mgi');
srw.add_parameter(myPlist,'destype','file');
srw.add_parameter(myPlist,'desformat','pdf');
srw.add_parameter(myPlist,'documentnumber','17181');
srw.add_parameter(myPlist,'papertype','N');
srw.add_parameter(myPlist,'desname','c:\temp\17181.pdf');
myIdent := srw.run_report(myPlist);
myStatus := srw.report_status(myIdent);
srw.stop_Debugging;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
NULL;
END PROJECTOVERVIEWREPORT1;
Iam running the oc4j instance and the report server in my local machine.
when i have typed http://localhost:8888/reports/rwservlet
Iam able to see the help page.
My rdf file is placed in OralceHome/reports/integ folder.
Iam executing my stored procedure it is returning some error.
Iam doing any thing wrong.
Do i need to modify anything.
Is the place of rdf file correct.
plz help me solving the above problem.
--KalyanThis is the error message iam getting..
any idea????
* WELCOME TO EVENT-BASED-REPORTING API *
* API-Version : 9i *
* (C) Oracle Corporation, 2000 *
* Debugging turned ON *************************************
*** Length of Paramlist : 1
OK : Parameter added : GATEWAY=http://localhost:8888/reports/rwservlet
*** Length of Paramlist : 2
OK : Parameter added : SERVER=rep_kalyan1
*** Length of Paramlist : 3
OK : Parameter added : REPORT=BillFormat.RDF
*** Length of Paramlist : 4
OK : Parameter added : USERID=atl3_dev_jul04/atl3_dev_jul04@mgi
*** Length of Paramlist : 5
OK : Parameter added : DESTYPE=file
*** Length of Paramlist : 6
OK : Parameter added : DESFORMAT=pdf
*** Length of Paramlist : 7
OK : Parameter added : DOCUMENTNUMBER=17181
*** Length of Paramlist : 8
OK : Parameter added : PAPERTYPE=N
*** Length of Paramlist : 9
OK : Parameter added : DESNAME=c:\temp\17181.pdf
Starting run_report: building url
*** Building URL (RUN_REPORT)
OK : URL built : http://localhost:8888/reports/rwservlet?SERVER=rep%5Fkalyan1&REPORT=BillFormat%2ERDF&USERID=atl3%5Fdev%5Fjul04%2Fatl3%5Fdev%5Fjul04%40mgi&DESTYPE=file&DESFORMAT=pdf&DOCUMENTNUMBER=17181&PAPERTYPE=N&DESNAME=c%3A%5Ctemp%5C17181%2Epdf&statu
*** Submitting HTTP Request
*** using URL :http://localhost:8888/reports/rwservlet?SERVER=rep%5Fkalyan1&REPORT=BillFormat%2ERDF&USERID=atl3%5Fdev%5Fjul04%2Fatl3%5Fdev%5Fjul04%40mgi&DESTYPE=file&DESFORMAT=pdf&DOCUMENTNUMBER=17181&PAPERTYPE=N&DESNAME=c%3A%5Ctemp%5C17181%2Epdf&statusf
ERROR : HTTP request failed -
Displaying data from stored procedure into textbox fields based on user input.
I have a stored procedure that is selecting data from a table called "Vendor" in my database. The data that is being returned are vendor names, vendor addresses, vendor Id's, etc...In my stored proc, I have one parameter that allows
the user to enter a vendor name and then return all the data for that specific vendor. The report that I'm building is going to look like a basic form with a bunch of textboxes on the screen labeled Vendor Address, Vendor Id, Vendor City, Vendor State,
etc...In the report I'm trying to build, the user will enter in a vendor name and then it will return all of the vendor's data based on what the user searches for. However, the report will only return ONE vendor's data at a time.
The problem is that some of the data in the database has very similiar vendor names, but different vendor addresses, vendor Id's, etc...In some instances the vendor name is actually
exactly the same, but the vendor address, vendor city, vendor Id, is all different. So what I did was added another parameter in my report that shows a drop down list of vendor names based on the wildcard search the user just did and
allows the user to select the exact vendor name that he/she is looking for based on what they searched. The problem I'm having is that I don't know what expression I need to put in each one of my textboxes to retrieve the correct data from
the vendor table that the user selects from the drop down list. So what I want to do is return the exact data from the vendor table based on the selection that the user makes from that drop down list. It's like I somehow have to compare the
drop down list parameter directly to the dataset but I don't know what expression needs to go in the textbox. I've tried...=First(Fields!VendorName.Value, "DataSet1").EqualsParameters!DropDownList.Value(0) but I keep getting an error message.
--Here is an example of the kind of thing the user might search for...when the user searches the word "sprint" it returns three different vendor names to the drop down list.
1. sprint
2. sprint
3. sprint co
Each one of those three vendor names has a different vendor address, vendor city, vendor ID, etc...but the vendor names are extremely similar and in some cases
exactly the same. In my report now I can't get the textboxes to return the correct data based on what the user selects. Any advice at all is greatly appreciated.
P.S. I didn't even know what SQL Server was a month ago and had zero knowledge of SSRS at all. I've learned a lot recently, but if you could explain a solution in the easiest way possible I would appreciate it. Thanks!Hi Jrcowles,
If I understand you correctly, you wnat to list all the Vendor Name which like the user typed Vendor Name on a drop-down list, right? If in this case, we can use a cascading parameters to achieve your requirement. I have tested it on my local environment,
the steps below are for you reference.
Create an other stored procedure using the query below.
CREATE PROCEDURE GetVendorName
@VendorName NVARCHAR(50)
AS BEGIN
exec( 'SELECT * FROM Vendor WHERE VendorName LIKE ''%'+@VendorName+'%''')
END
Create another dataset DataSet2 and using the new created procedure.
Create another parameter VendorName2 and check "Allow Multiple Values" for this parameter.
On the Available Values tab, check "Get values from a query". Select corresponding dataset and field.
On the Default Values tab, check "Get values from a query". Select corresponding dataset and field.
The screenshots below are for you reference.
Reference
http://technet.microsoft.com/en-us/library/aa337169(v=sql.100).aspx
http://www.msbiguide.com/2012/02/adding-cascading-parameters-to-ssrs-reports/
Regards,
Charlie Liao
TechNet Community Support
Maybe you are looking for
-
Problem in IP10 with the date of the task list
Hello all!!!!! I have a problem when I'm duplicating a task list. I can duplicate the task list correctly, then i assign it to a generated maintance plan ( I'm only changing the plnal field because i'm changing the center of the task list). Then I go
-
Would anyone know how to fix a strobbing display? Since January I have had the logic board and hard drive replaced. I don't know why the display would be flashing again. I'd appreciate any info on this. Thanks imac G-5 Mac OS X (10.4.4)
-
Hover Functionality on Webi Reporting
Hi, I was wondering if webi reporting allows us to implement hover functionality wherein if we choose to hover over particular row it shows the column value that we want to display when the users hover. The reason for analyzing this requirement is be
-
Adobe Premiere Elements Won't Start A New Project?
When I open up Premiere Elements and try to start a new project, all it shows is a black and purple line, then it just stops. I have already tried updating QuickTime, Windows 7, Nvidia Drivers, and Uninstalling and then Reinstalling Premiere elements
-
Should I upgrade my Macbook RAM, or go to PC laptop?
Hello, I bought my 2GHz Intel Core 2 Duo 13" Macbook in mid 2008. Recently I replaced the hard drive (dropping the computer killed the original HD) with another 80gig. It currently has 1 GB of memory. I'm running Snow Leopard. I used to do film editi