JTA (EJB-- Store Procedure) Problem
I'm currently facing a problem that I'm not sure how to fix it.
I have a Controller class that is accessing many EJB (Session Stateless Container Managed) that are a kind of Store Procedures' Wrappers.
The Controller initializes the transaction using the UserTransaction and it commits or rollback as needed, also de EJBs at some points use the setRollbackOnly() and also inside the store procedures are some explicit commits.
What should I expect in the following scenario:
UserTransaction ut=null;
try {
ut = getUserTransaction();
ut.begin();
ejb1.update(); //Calls a store procedure that in the pl/sql calls commit
ejb2.delete(); //Inside the Ejb some component throws an exception and is catched by the Ejb, then it calls setRollbackOnly() and throws a new Exception
ut.commit();//This is not called because the previous exception
} catch(Exception e){
ut.rollback();//Rollback is called
1) Is the modified data inside ejb1.update saved?
2) Is this all wrong?
3) What could it be a right approach to refactor this?
Thanks,
Johann
johann renck wrote:
> There is one store proc who cares about logging that is called by many others sp that
> is the one who does commit and also is wrapped by an Ejb so it is also called inside
> the application. Have this sp its own transaction context so when it does commit it
> just commits the logging?
>
> Thanks,
> Johann
Yes, always. Any procedure that calls begin tran, commit, rollback, or any other call that
changes the transactional behavior of the session, must be isolated from everything that
WebLogic thinks is part of a transaction. Otherwise you're just going to jeopardize the
integrity of your WebLogic-defined transactions. Ideally, you want all your transactions
defined and controlled at one level. From the EJB/WebLogic point of view it would be much
safer and superior to never call any procedure that had such stuff, and then do logging
as it's own WLS EBJ tx, called everywhere needed, from within but separate from larger EJB
transactions. Even if a logging EJB did nothing besides writing one log row, the procedure
shouldn't call commit. The EJB system will do that.
Note well: Anything that calls that logging procedure with the commit, commits it's
current possibly partial transaction to that point. The DBMS connection only has one
transaction going on at a time, and a commit permanently locks in everything changed since
the last commit. It is not good architecture to have commits in any utility procedure.
At the very least, if your procedures want a transaction, they should start and end
in one procedure, eg:
BEGIN
declare boolean variable in_tx
set in_tx true if @@trancount > 0
if (not in_tx) BEGIN TRAN -- Otherwise, just become part of current tx
... do work... this is only needed for multi-update work
if (not in_tx) COMMIT TRAN
END
If the procedure only does one update/insert/delete *you don't need any
tx control*! eg:
BEGIN
insert into mylogtable values (.....)
END
That one insert will be part of any ongoing tx if extant, or
will be it's own one auto-commit tx.
If you have a procedure that must be it's own tx, then you must
do:
BEGIN
if (@@trancount > 0) raiserror("Can't call this procedure from an ongoing transaction. It must be able to commit immediately")
END
Similar Messages
-
Exec XP_CMDSHELL cannot find store procedure problem
I run EXEC sp_configure 'xp_cmdshell', 1
Message is"....change from 1 to 1 "
Then
EXECXP_CMDSHELL 'Dir N:'
cannot find store procedure xp_cmdshell
I check master database.
No dbo.xp_cmdshell under store procedure.
How to fix it? I need run command
EXECXP_CMDSHELL 'Dir N:'
ThanksHallo Bestrongself,
- what SQL Server version do you use?
- since SQL 2005 xp_cmdshell is located in the sys-schema and the procedure itself is located in the resource database of Microsoft SQL Server.
You can check xp_cmdshell by using the following command:
SELECT * FROM sys.all_objects WHERE name = 'XP_CMDSHELL'
I bet you will see it in the master database because you cannot drop system procedures and will return an error if you try to do so:
USE master;
GO
BEGIN TRANSACTION
DROP PROCEDURE dbo.xp_cmdshell;
DROP PROCEDURE sys.xp_cmdshell;
DROP PROCEDURE xp_cmdshell;
ROLLBACK TRANSACTION
To execute xp_cmdshell you need to have [CONTROL SERVER] permissions otherwise it won't work. Let's say I have a login which I grant exclusive permissions to execute xp_cmdshell it will fail!
USE master;
GO
-- create the login and the user in master-database
CREATE LOGIN test WITH PASSWORD = 'glmdpf12345', CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF;
CREATE USER test FROM LOGIN [Test];
GO
-- grant explicit permission to execute the xp_cmdshell
GRANT EXECUTE ON sys.xp_cmdshell TO test;
GO
-- tryp to execute xp_cmdshell as test
EXECUTE AS login = 'test'
EXEC xp_cmdshell 'DIR C:';
REVERT
-- Housekeeping
REVOKE EXECUTE ON sys.xp_cmdshell TO test;
DROP USER 'test';
DROP LOGIN 'test';
As you can see from the above statement the login "Test" got exclusive permission to execute xp_cmdshell but the execution will fail with the following error message:
The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.
The above error message is clear. Test is a "normal" user which has the permission to execute the proc BUT due to missing permissions to retrieve the information about the service account it fails!
You have to grant SERVER CONTROL to the account.
So - next step...
What is your permission on server level?
You can check your permissions by using the following statement:
-- what are my permissions on server level
-- check for CONTROL SERVER!
SELECT * FROM sys.fn_my_permissions (NULL, 'SERVER') ORDER BY permission_name;
-- what are my permissions for the object xp_cmdshell
SELECT * FROM sys.fn_my_permissions('xp_cmdshell', 'OBJECT');
Can you provide us with the results of the above query?
BTW: xp_cmdshell is a well documented statement and official command which is fully supported by Microsoft. You can find all information about functionality and security of xp_cmdshell here:
http://technet.microsoft.com/en-us/library/ms175046.aspx
MCM - SQL Server 2008
MCSE - SQL Server 2012
db Berater GmbH
SQL Server Blog (german only) -
Double store procedure problem
Hi all
I have something like String[] checked = request.getParameterValues("mybox");
HttpSession userSession = request.getSession(true);
HttpSession session=request.getSession();
String first=(String)session.getAttribute("first");
String select ="";
String Myall =" ";
try {
if(first==null){
conn =connectionPool.getConnection();
cs = conn.prepareCall("{call download_Onepage(?)}");
for(int i=0; i<checked.length;i++){
select=checked;
cs.setString(1,select);
connectionPool.returnConnection(conn);
rs = cs.executeQuery();
while(rs.next()) {
MyDataBean mydata = new MyDataBean();
mydata.setName(rs.getString("Name"));
mydata.setSequence(rs.getString("sequence"));
data.add(mydata);
}//end for
}//end if
else{
conn =connectionPool.getConnection();
cs = conn.prepareCall("{call checked()}");
connectionPool.returnConnection(conn);
while(rs.next()) {
Myall=rs.getString("NewNum");
conn =connectionPool.getConnection();
cs = conn.prepareCall("{call download_Onepage(?)}");
cs.setString(1,Myall);
// cs.setString(1,Myall);
connectionPool.returnConnection(conn);
rs = cs.executeQuery();
while(rs.next()) {
MyDataBean mydata = new MyDataBean();
mydata.setName(rs.getString("Name"));
mydata.setSequence(rs.getString("sequence"));
data.add(mydata);
}//end while
}// end else
my if work find and else always got not point error, why ??
and my storr procedure is
create proc checked
AS
begin
begin transaction
select * FROM pubs.dbo.temp
if @@error <>0 or @@rowcount !=1
begin
rollback
return
end
commit transaction
end
GOwhy is imposible to use the result in one procedure to call another procedure ??
if my code is one procedure like I got the out put
cs = conn.prepareCall("{call checked()}");
ResultSet rs = cs.executeQuery();
while(rs.next()) {
NewNum=rs.getString("NewNum"); }
out.print(""+NewNum+"");but if I add othe rprocedure I got nothing
while(rs.next()) {
NewNum=rs.getString("NewNum"); }
cs = conn.prepareCall("{call download_Onepage(?)}");
cs.setString(1,NewNum);
rs = cs.executeQuery();
while(rs.next()) {
Name=rs.getString("Name"); }
out.print(""+NewNum+"");
out.print(""+Name+"");
out.print("</body></html>");
out.close(); -
Permission problem calling a java object from a store procedure
When I run my store procedure
CREATE OR REPLACE PACKAGE BODY confirms_write_to_file
AS
FUNCTION translate(in_en_var in VARCHAR2)
RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'translate.translatePath(java.lang.String) return java.lang.String';
PROCEDURE write_to_file(in_file_name IN VARCHAR, in_en_var IN VARCHAR)
IS
file_handle UTL_FILE.FILE_TYPE;
file_location VARCHAR2(50);
BEGIN
file_location := translate(in_en_var);
dbms_output.put_line ('opened file location' ||file_location);
END write_to_file;
END confirms_write_to_file;
I get the following error:
exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
SQL> exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
Exception java.security.AccessControlException: the Permission
(java.io.FilePermission <<ALL FILES>> execute) has not been granted by
dbms_java.grant_permission to
SchemaProtectionDomain(RIMS|PolicyTableProxy(RIMS))
opened file locationProcess problem
PL/SQL procedure successfully completed.
When I try to to grant myself the permissions
begin
dbms_java.grant_permission('rims','java.io.FilePermission','*','execute');
dbms_java.grant_permission('rims', 'java.lang.RuntimePermission', '*','writeFileDescriptor' );
end;
I get the following Error:
oracle.aurora.vm.IdNotFoundException: rims is not a user or role
at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
at
oracle.aurora.rdbms.security.PolicyTableManager.findAll(PolicyTableManager.java)
at oracle.aurora.rdbms.security.PolicyTableManager.find(PolicyTableManager.java)
at
oracle.aurora.rdbms.security.PolicyTableManager.activate(PolicyTableManager.java
at
oracle.aurora.rdbms.security.PolicyTableManager.grant(PolicyTableManager.java)
begin
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.aurora.vm.IdNotFoundException: rims is not a user or role
ORA-06512: at "SYS.DBMS_JAVA", line 0
ORA-06512: at line 2
My java code is as follows
import java.io.*;
import java.util.*;
class translate
public static String translatePath(String envar)
Runtime rt = Runtime.getRuntime();
int bufSize = 4096;
byte buffer[] = new byte[bufSize];
String path = null;
Process p = null;
int len = 0;
try
p = rt.exec("echo "+envar);
BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
while ((len = bis.read(buffer, 0, bufSize)) != -1)
System.out.write(buffer, 0, len);
path = new String(buffer);
p.waitFor();
catch(Exception e)
System.out.println("Exception "+e);
return "Process problem ";
return path;Tony,
I answered this very same question that you posted at the JavaRanch forum.
Good Luck,
Avi. -
Problem with Pie chart, Store Procedure and Category Axis
Hi All,
I'm having a problem when i try to use a Pie Chart with a store procedure
when Category Axis - Field value is "none", the chart appears, but the description say Undefined
but when i put any field from store procedure, the chart doesn't show.
when I try the same with a normal SQL statement, all data was displayed
my store procedure only have 2 columns
n - numeric
state - text
The Store Procedure and the SQL, returns the same data in the same order
Thanks in advance
CristianHi guys,
I need guide on creating a system using store procedure, referring to this thread: JDBC System Connection VS BI JDBC System Connection
Hope you can help me out.
Thanks a lot,
Sarah -
ADF 11, USING EJB, CALL STORE PROCEDURE, A PROBLEAM?
ADF 11, USING EJB, CALL STORE PROCEDURE, A PROBLEAM?
I have a store procedure:
CREATE OR REPLACE PACKAGE BODY PK_HR1
IS
FUNCTION FUNC04
RETURN CUR_RESULT
IS
X_CUR CUR_RESULT;
BEGIN
OPEN X_CUR FOR
select mako, tenko, diachiko from kho;
RETURN X_CUR;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END FUNC04;
END PK_HR1;
In the entities class, I have a NamedStoredProcedureQuery:
@Entity
@NamedStoredProcedureQuery(name="Kho.FUNC04",
resultClass=Kho.class,
procedureName="PK_HR1.FUNC04" )
public class Kho implements Serializable {
In session bean, i have a method
public class SessionEJBBean implements SessionEJB, SessionEJBLocal
public void test() throws Exception{
try {
//code here ...
List<Kho> listKho = em.createNamedQuery("Kho.FUNC04").getResultList();
System.out.println("aaaa");
} catch (Exception ex) {
ex.printStackTrace();
} finally {
I try running, but always show errror
this errors:
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'FUNC04' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
Call: BEGIN PK_HR1.FUNC04(); END;
Query: ReadAllQuery(jp.co.mfr.sgs.bean.Kho)
help help me?You need to use a CallableStatement for this.
--olaf -
Problem listing code of a store procedure
i am trying to list code of a store procedure by running following sql
select text from user_source where name = 'sp_insert_hpemployee' and type = 'procedure';
it says
no rows selected
can you please let me know where i am going wrong.select text from user_source where UPPER(name) = 'SP_INSERT_HPEMPLOYEE' and upper(type) = 'PROCEDURE';
or
select dbms_metadata.get_ddl('PROCEDURE','SP_INSERT_HPEMPLOYEE') from dual; -
Problem of retrieve a set of data when calling store procedure using vb with ODBC
when I use ODBC, it can return 1 record (1 field) using pass and retrieve the parameter. but it cannot success when return a set of data (using recordset to store it), when i do it, the error message (Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if availabl. No work was done.). Why ? and how can solve it ?\
Thanks in advance.oh, really ? it is not use ODBC to connecto to oracle ?
Here is my program code:
STORE PROCEDURE:
PROCEDURE getInforcePolicy(PClient_ID IN VARCHAR2, PPolicy_No IN VARCHAR2, BasicCur OUT oraoledb.m_refcur, RiderCur OUT oraoledb.m_refcur)
IS
BEGIN
OPEN BasicCur FOR SELECT * FROM
inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No = 1;
OPEN RiderCur FOR SELECT * FROM
inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No <> 1;
END getInforcePolicy;
PACKAGE oraoledb AS
TYPE m_refcur IS REF CURSOR;
END oraoledb;
Program:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim paramclient As New ADODB.Parameter
Dim parampolicy As New ADODB.Parameter
Dim I As Integer
cn.Open "ridev", "abc","abc"
cmd.ActiveConnection = cn
Set paramclient = cmd.CreateParameter("PClient", adVarChar, adParamInput, 10)
Set parampolicy = cmd.CreateParameter("PPolicy", adVarChar, adParamInput, 10)
paramclient.Value = "0000023011"
parampolicy.Value = "HK0010021U"
cmd.Parameters.Append paramclient
cmd.Parameters.Append parampolicy
cmd.CommandText = "{call getInforcePolicy}"
Set rs = cmd.Execute
Do While Not rs.EOF
Loop
Set rs2 = rs.NextRecordset
Do While Not rs2.EOF
loop
Where the RIDEV is a datasource that created from Data Source in Control Panel using the driver call "Microsoft ODBC for ORACLE" -
(Resolved) How to execute 2 store procedures in 1 transaction?
public void method1(){
Session session = getSessionFactory().acquireSession();
StoredProcedureCall spc1 = new StoredProcedureCall();
spc1.setProcedureName("PKG.SP1");
spc1.addNamedArgumentValue("param", "aaa");
session.executeNonSelectingCall(spc1);
StoredProcedureCall spc2 = new StoredProcedureCall();
spc2.setProcedureName("PKG.SP2");
spc2.addNamedArgumentValue("param", "bbb");
session.executeNonSelectingCall(spc2);
The above method is defined in SessionFacadeBean (just like the EJB in SRDemo),
I want the above 2 procedures executed in 1 transaction. If spc2 failed, the spc1 should not be committed. How can I do this?
Regards,
Jason
Message was edited by:
Jason.LuI have changed code as follows:
public void method1(){
DatabaseSession session = getSessionFactory().getSharedSession();
session.beginTransaction();
try{
StoredProcedureCall spc1 = new StoredProcedureCall();
spc1.setProcedureName("PKG.SP1");
spc1.addNamedArgumentValue("param", "aaa");
session.executeNonSelectingCall(spc1);
StoredProcedureCall spc2 = new StoredProcedureCall();
spc2.setProcedureName("PKG.SP2");
spc2.addNamedArgumentValue("param", "bbb");
session.executeNonSelectingCall(spc2);
} catch (Exception e) {
session.rollbackTransaction();
} finally {
session.release();
It seems that the "session.rollbackTransaction();" will be executed if spc2 fails.
toplink logs are as follows:
[TopLink Info]: 2007.11.12 10:20:36.690--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--default login successful
[TopLink Finer]: 2007.11.12 10:20:36.690--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--TX beginTransaction, status=NO_TRANSACTION
[TopLink Finer]: 2007.11.12 10:20:36.705--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--TX Internally starting
[TopLink Finer]: 2007.11.12 10:20:36.705--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--external transaction has begun internally
[TopLink Fine]: 2007.11.12 10:20:36.705--ServerSession(1901666)--Connection(11203640)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--BEGIN PKG.SP1(param=>'aaa'); END;
[TopLink Fine]: 2007.11.12 10:20:36.971--ServerSession(1901666)--Connection(22861541)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--BEGIN PKG.SP2(param=>'bbb'); END;
[TopLink Warning]: 2007.11.12 10:20:37.440--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070608)): oracle.toplink.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'SP2'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
[TopLink Finer]: 2007.11.12 10:20:37.455--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--TX rollbackTransaction, status=STATUS_ACTIVE
[TopLink Finer]: 2007.11.12 10:20:37.455--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--TX Internally rolling back
[TopLink Finer]: 2007.11.12 10:20:37.455--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--external transaction has rolled back internally
The problem is the 1st store procedure is committed (it should be rolled back!), and the database is updated.
Thanks,
Jason -
Front-End Service Starup Error: Store procedure to GET progress vector failed.
Hi,
We have a two front end servers in our Lync deployment and I'm getting an interesting error message on one of the servers when the "Lync Server Front-End Service" is starting up. All the services on that server will eventually start but I'm pretty
sure it's affecting users in some way.
Here is the error message in the Event Viewer:
Log Name: Lync Server
Source: LS User Services
Date: 2013-09-17 8:00:32 AM
Event ID: 32194
Task Category: (1006)
Level: Error
Keywords: Classic
User: N/A
Computer: BGC-VAN-LYNC2.domain.ca
Description:
Store procedure to GET progress vector failed.
Execution Error: 0x00000000(ERROR_SUCCESS).
Native Error: 8144.
Error Details: [# [Microsoft][SQL Server Native Client 11.0][SQL Server]Procedure or function SyncReplicationGetProgressVector has too many arguments specified. #].
Cause: This may indicate a problem with connectivity to local database or some unknown product issue.
Resolution:
Ensure that connectivity to local database is proper. If the error persists, please contact product support with server traces.
Event Xml:
<Event xmlns=>
<System>
<Provider Name="LS User Services" />
<EventID Qualifiers="50158">32194</EventID>
<Level>2</Level>
<Task>1006</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-09-17T15:00:32.000000000Z" />
<EventRecordID>16971</EventRecordID>
<Channel>Lync Server</Channel>
<Computer>BGC-VAN-LYNC2.domain.ca</Computer>
<Security />
</System>
<EventData>
<Data>0x00000000(ERROR_SUCCESS)</Data>
<Data>8144</Data>
<Data>[# [Microsoft][SQL Server Native Client 11.0][SQL Server]Procedure or function SyncReplicationGetProgressVector has too many arguments specified. #]</Data>
</EventData>
</Event>
The error happens 15 times every minute, following with this event:
Name: Lync Server
Source: LS User Services
Date: 2013-09-17 8:23:46 AM
Event ID: 32189
Task Category: (1006)
Level: Information
Keywords: Classic
User: N/A
Description:
The following Fabric service for routing groups have been closed:
{F515134C-71B7-52FD-B0C3-6A9DB39CF750}
{8A5D6B36-2A01-53DB-BC4E-3286C05E0836}
{B35AAFC9-F6BF-5FFE-8C31-4AA5C36B2065}
{69223418-78DC-5066-81A8-78E05914EC7B}
{80414C96-1137-5DDC-8387-C3EA7A54B078}
{641E6ABD-B862-55A1-B1B1-C83BC92D2F85}
{1EA68EA4-77F7-5CFC-B781-0093CBC18403}
{2FDE333D-FF7F-5D6A-B85B-93ADC1EAC12A}
{A43BBA3A-8963-51C4-BD7A-19E1EC3DDFDB}
{D3F4532F-61C8-5072-9B3B-3E2CCF15442F}
{4449243E-5E96-56AC-AB6B-C5E785543542}
{58B30261-65B6-5F6A-BC50-60F85782D052}
{DB4B76B0-2510-5BF8-A7B1-8B37BD3AA7B9}
{917CC217-966B-56AC-A912-97BA64BA13EB}
Anyone knows what this is about and how to resolve this?
Thanks,
VH.Hi,
Please try to reset registrar state:
http://tsoorad.blogspot.in/2013/04/lync-2013-ee-pool-wont-start.html
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make
sure that you completely understand the risk before retrieving any suggestions from the above link.
Kent Huang
TechNet Community Support -
Error when run crystal report with store procedure in JSP
I try to run report which is developed by crystal report XI and store procedure (SQL 2005) with JSP.
But it occurs error that is "com.crystaldecisions.reports.reportengineinterface.JPEReportSource - failed to process getPage request: No results were returned by the query."
How can I do for solving this problem? Pls, help me !!!!!
(In other report which is not used store procedure I can run fine.)
Message was edited by:
Bonds_IdentityWhat version of CR are you using?
What CR updates are you using?
See sample apps here:
https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
in particular check out vbnet_win_pass_dataset_main_sub.zip
The [Crystal Reports for Visual Studio 2005 Walkthroughs|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2081b4d9-6864-2b10-f49d-918baefc7a23] will also be good to look at.
Ludek
Follow us on Twitter
http://twitter.com/SAPCRNetSup -
Error message when issuing a COMMIT in a store procedure
Hello experts,
Please help.
I have a problem where i cannot specify a COMMIT in a store
procedure. I have the following error message:
=================================================================
00034, 00000, "cannot %s in current PL/SQL session"
// *Cause: An attempt was made to issue a commit or rollback
from a PL/SQL
// object (procedure, function, package) in a session
which has this
// disabled (by 'alter session disable commit in
procedure')
// *Action: enable commits from PL/SQL in this session, or don't
attempt
// to use commit or rollback in PL/SQL when they are
disabled
// in the current session.
=================================================================
Thanks very much for a reply
Kind regards
YogeerajThe solution is to issue the statement
alter session enable commit in procedure;
However, I'd think carefully about doing this. Procedures are
often called as part of a wider transaction. If the procedure
issues a commit ALL the preceding work is also commited. If
there is something subsequent in the transaction that fails and
issues a rollback, it will onlt rollback the work done after the
procedure. This may lead to your database being in an
inconsistent state.
rgds, APC -
Insert and update same record of table using store procedure in oracle 10g
Hi,
I am using oracle sql developer for this.
I have created Store procedure which run after every 30mins of interval.
the problem is Ii need to insert data for first time of day then later that same record should update for particular field(here its plan code).
if new field is coming (if new plan code is generated) then it should insert data and again update same for interval.
means for each plan individual record(i.e. plan wise summary) should be there for only a day. next day new record for same plan.Hi,
You should use Merge like shown below:-
Merge into original_table a
using second_table b
on (a.primary_key=b.primary_key and a.primary_key........)
when match then
update set column_list=b.column_list
when not match then
isert into (column list)
values(a.column_list)If you dont know much about merge then follow below link..
http://www.oracle-developer.net/display.php?id=203
http://www.oracle-base.com/articles/10g/merge-enhancements-10g.php -
Hi Guys,
Does anyone know if it is possible to implement a java store procedure that will be subsequently called in a "select" operation within a "where" statement in Oracle 9R2?
Thanks,
AndreaHi Andrea,
From your sample code, I get the impression that you aren't too familiar
with Oracle (and perhaps even databases in general?). This leads me
to believe that you are looking for someone who will do your work for
you. If that is the case, then I suggest you employ an independent
contractor (or consultant) who, I'm sure, will be more than happy to
accomodate you -- and I'm sure will do a much better job than I can
(via this forum).
Please forgive me if my interpretation is incorrect, however I feel,
that with a little effort on your behalf, you can find the solutions
to your problem by looking through the Oracle documentation, sample
code and "how-to" documents that are available from Oracle's "Technet"
web site:
http://technet.oracle.com
If, after that, you run into a specific problem, then please ask a
specific question on this forum and I will try to provide a specific
answer (if I can :-).
Good Luck,
Avi. -
About JDBC CALL STORE PROCEDURE with out parameter is greater than 4000
Hi Guys,
I have a problem call store procedure with a large string.
as i know varchar2 can contain 32767 characters in pl/sql .
But when i used varchar2 as a out parameter in a store procedure, if the out parameter is greater than 4000 characters , it always give me error message as 'the buffer is too small'.
why it happened?
I read some article that says i need configure a property in data-source.xml , and jdbc 10g driver already solved this problem, but i used jdev 10.1.3.2 ,the driver should be fine.
How can i solve this problem?
Thanks in advance,
AppCatObject is Foundation, Execute Script
This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
conn = ds.getConnection();
stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
rs = stmt.executeQuery();
rs.next();
patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
} finally {
try {
rs.close();
} catch (Exception rse) {}
try {
stmt.close();
} catch (Exception sse) {}
try {
conn.close();
} catch (Exception cse) {}
Maybe you are looking for
-
I cannot install iTunes 10.6
Currently, I use iTunes 10.1.2 with OS 10.5.8. I want to use my new iPad with the computer but I need to install at least iTunes 10.5 to do so. I cannot find any download source for 10.5 and my attempts to download the latest iTunes, 10.6, from the A
-
How do I get into my iPad if I forgot my password
Help me! I forgot my password to my iPad!
-
How can i find the messages in the log
I want to see the all the error/information messages in the message log (buffer) , how can i view them? is there any table or function module for that? I'm trying to delete error/information messages before a user can see on the screen in the sales
-
I have a JDBC transaction that is not committing to the database, but is also not throwing an error. The scenario is this: JMS message arrives on transactional queue Message processed by MDB MDB calls several Sybase ASE stored procedures JDBC transac
-
Best practice migration 10.4.11 G4 PPC to Intel server
We are ready to upgrade our aging server to a new Intel system. I am wondering the easiest approach. The current server is not running the Universal 10.4. I don't believe there is any viable option that doesn't require lots of hands on rebuilding to