Sender JDBC with Stored Procedure or Function
Hi.
I have a problem to update a row that I obtain from sender JDBC (using SELECT or calling to a FUNCTION).
As the consultation is so complex and the table has fed up transactions, often it takes the registry A and updates register B.
Try to use the level of transaction Serializable (/people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter) but it throws the following error to me:
"The JDBC driver returned the following error message: 'java.sql.SQLException: ORA-08177: can't serialize access for this transaction '. For details, contact your database server vendor."
Try to invoke to a function (/people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter) but when placing a sentence of UPDATE within the function throws an error, I reviewed to me and calling to a function from a SELECT, Oracle it does not allow to modify registries of the database.
Some other suggestion?
Hi,
See this link,
Here is an example of mapping for synch JDBC.
/people/siva.maranani/blog/2005/09/16/xi-how-to-on-jdbc-receiver-response
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
Also go thru these links:
http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
/people/alessandro.berta/blog/2005/10/04/save-time-with-generalized-jdbc-datatypes
http://help.sap.com/saphelp_nw2004s/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/frameset.htm
Regards,
Akshay Jamgaonkar.
Reward points if find useful.
Similar Messages
-
Sender JDBC Adapter - Stored procedure
Hello all, I just read a lot of topics in this forum about this subject.
I found two indications in contracdictions in the documentation :<a href="http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/frameset.htm">Configuring the Sender JDBC Adapter</a>
1. Concerning Query SQL Statement
You have the following options:
● Specify a valid SQL SELECT statement to select the data to be sent from the specified database.
● Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
2. Concerning Update SQL Statement :
This is recommended if the data has not only been read, but also changed by a stored procedure entered under Query SQL Statement.
It is ambigous, isn't it ?
My question is simple :
Does somebody already use Sender JDBC Adapter with Stored procedure as Select statement including many steps :
- update actions on database
- select query to return data to XI adapter
(Update statement stay empty or with value <TEST>.
To provide more information, I have a reference table to read. But this reference table must be updated by a stored procedure before being able to be read accordingly.
So As I can't do both process with Sender Adapter (call a procedure and execute a select statement) => I want to include both actions (updates and select) in an alone stored procedure.
Could I get wanted data as a resultset ?Hi,
>><i>Update statement stay empty or with value <TEST>.</i>
It should be <TEST> if you do not want an Update to happen.
Regarding Sender JDBC adapter with stored procedures, which DB are you trying to access. Sender JDBC adapter does not support Oracle Stored Procedures as they return Cursors and Sender JDBC adapter can deal with only Resultset.
As for executing both Update and Select in the SP, though I havent tried, this should surely be possible.
Regards,
Bhavesh -
JDBC Sender adapter - Oracle - Stored Procedure - Error
Hello,
Need few clarifications on JDBC sender adapter and stored procedures when connecting to Oracle DB.
My scenario is, Oracle to SAPBW. So in sender JDBC adapter, we have used a SP having multiple SQL statements it, esp. one of the SELECT statment having Joins on a table and View.
My questions are,
1) Is it possible to have more SQL statements in SP for Sender JDBC?
2) Is the SP of Oracle DB returns resultset or cursor?
I have tried in searching the forum perticularly for connecting to Oracle as Sender and below like said that there is a limitation of XI JDBC when connecting to Oracle.
Executing an Oracle Stored Procedure from Sender JDBC adapter
So please clarify the doubts and help me.
With regards,
JilanHi Jilan,
Unlike what was mentioned in the link given by you that oracle returns cursor and not resultset is not completely true. It may be difficult but certainly not impossible.
Refer : http://www.enterprisedt.com/publications/oracle/result_set.html
regards
joel -
Post Author: Ranjith.403
CA Forum: General
Hi,
Am new to crystal reports with stored procedures
am created a report using a stored procedure in oracle. In that Stored Procedure am Using a temporary table.
After inserting values into the table am assigning to ref cursor.
Refcursor having fields like item,onhandstock,purchase rate
This report working fine in oracle version 9.2.0.1.0 where comes to oracle version 9.2.0.8.0 it's giving the varchar values correctly.
The Number values are showing as 0.
Help me to solve it.
Thanks in Advance,
RanjithTry modularising this large procedure into smaller procedures and functions, and determine which part is causing you trouble.
-
Java Stored Procedure via Function Give 0RA 600 from SQL Workshop and App
Hi,
Anyone experienced stored procedures or functions failing when called from APEX app or SQL Workshop ( ora 600 ) yet they work fine when called from SQLPlus?
Sqlplus connected as my apex workspace schema owner:
select net_services.test_db_connection_via_ldap(
'APEXPRD1', 'test1', 'test1', null ) as result from dual;
RESULT
The database connection attempt was SUCCESSFUL
From Apex Sql Worshop:
select net_services.test_db_connection_via_ldap(
'APEXPRD1', 'test1', 'test1', null ) as result from dual;
ORA-00600: internal error code, arguments: [16371], [0x434B08150], [0], [], [], [], [], [], [], [], [], []
NOTE: Same result when run in response to button push on page in application.
Apex Version: 3.2.1.00.10
Oracle Version: 11.1.0.7.0
NOTE: I am using the embedded plsql gateway; was going to try NOT using it to see if it was shared server related (seemed to be from trc files)
Any ideas?
Since the code works from sqlplus, I know that it's good: Here some snippets
-- ========================================================================================
public class NetServices extends Object {
public static String doTestDbConnectionViaLdap
String piDbConnUrl,
String piUserName,
String piUserPassword
String vResult = null;
try
Connection conn = null;
OracleDataSource ods = new OracleDataSource();
ods.setUser( piUserName );
ods.setPassword( piUserPassword );
ods.setURL( piDbConnUrl );
conn = ods.getConnection();
conn.close();
vResult = "The database connection attempt was SUCCESSFUL";
} catch ( SQLException e )
int vErrCode = e.getErrorCode();
String vErrMsg = e.toString();
if ( vErrCode == 1017 ) {
vResult = "The database connection attempt FAILED! Incorrect Username or Password";
} else if ( vErrCode == 17433 ) { // Null Username or Password
vResult = "The database connection attempt FAILED! You must provide both a Username and a Password";
} else if ( vErrCode == 17002 ) {
vResult = "The database connection attempt FAILED! Net Service Name was Not Found";
} else if ( vErrCode == 17067 ) { // NULL Net Service Name
vResult = "The database connection attempt FAILED! You must provide a Net Service Name";
} else {
vResult = "The database connection attempt FAILED! Error " + vErrCode;
return vResult;
} // method: doTestDbConnectionViaLdap
-- ========================================================================================
function do_test_db_connection_via_ldap
pi_db_conn_url IN VARCHAR2,
pi_user_name IN VARCHAR2,
pi_user_password IN VARCHAR2
return VARCHAR2
is -- PRIVATE to the net_services package
language java -- NOTE: See cr_java_class_NetServices.sql for actual java implementation
name 'NetServices.doTestDbConnectionViaLdap
( java.lang.String, java.lang.String, java.lang.String ) return java.lang.String ';
-- ========================================================================================
function test_db_connection_via_ldap
pi_net_service_name IN VARCHAR2,
pi_user_name IN VARCHAR2,
pi_user_password IN VARCHAR2,
pi_search_base IN VARCHAR2
return VARCHAR2
is -- PUBLIC procedure
v_url VARCHAR2(256);
begin
g_err_source := 'NET_SERVICES.test_db_connection_via_ldap';
g_err_action := 'build_jdbc_conn_url_using_oid';
/* NOTE: We don't want to assert the parameters because we don't want to raise
an exception;
-- Get the jdbc connection url that uses oid info
v_url := build_jdbc_conn_url_using_oid( pi_net_service_name, pi_search_base );
return( do_test_db_connection_via_ldap( v_url, pi_user_name, pi_user_password ) );
end test_db_connection_via_ldap;
-- ========================================================================================
Thanks in advance for your consideration.
TroyTroy:
You could be right in your guess that the error is related to MTS. Search Metalink for '16371'. Why not switch your APEX app to use OHS and test whether the error persists. ?
varad -
Diif between Stored procedure and function
HI
I want all the differences between Stored procedure and function.
Even the basic diff is Procedure does not return any value and Function must be...
Thansk In advance...1) Functions are used for computations where as procedures can be used for performing business logic That's an opinion on usage not an actual difference.
3) You can have DML(insert,update, delete) statements in a function. But, you can not call such a function in a SQL query.Not true. As User defind functons limitations we can use a function that issues DML in a SELECT statement, if it uses the PRAGMA AUTONOMOUS_TRANSACTION.
4) Function parameters are always IN, no OUT is possibleEasily refutable...
SQL> CREATE OR REPLACE FUNCTION my_f (p OUT NUMBER) RETURN DATE
2 AS
3 BEGIN
4 p := to_number(to_char(sysdate, 'DD'));
5 RETURN sysdate;
6 END;
7 /
Function created.
SQL> var x number
SQL> var d varchar2(18)
SQL> exec :d := my_f(:x)
PL/SQL procedure successfully completed.
SQL> print d
D
18-NOV-05
SQL> print x
X
18
SQL>
Stored Procedure :supports deffered name resoultion Example while writing a stored procedure that uses table named tabl1 and tabl2
etc..but actually not exists in database is allowed only in during creationNot sure what this one is about...
SQL> CREATE PROCEDURE my_p AS
2 n NUMBER;
3 BEGIN
4 SELECT count(*) INTO n
5 FROM tab1;
6 END;
7 /
Warning: Procedure created with compilation errors.
SQL> sho err
Errors for PROCEDURE MY_P:
LINE/COL ERROR
4/4 PL/SQL: SQL Statement ignored
5/9 PL/SQL: ORA-00942: table or view does not exist
SQL>
7) A procedure may modifiy an object where a function can only return a value.An ounce of test is worth sixteen tons of assertion...
SQL> CREATE OR REPLACE FUNCTION my_f2 RETURN VARCHAR2
2 AS
3 BEGIN
4 EXECUTE IMMEDIATE 'CREATE TABLE what_ever (col1 number)';
5 RETURN 'OK!';
6 END;
7 /
Function created.
SQL> exec :d := my_f2
PL/SQL procedure successfully completed.
SQL> desc what_ever
Name Null? Type
COL1 NUMBER
SQL> I think there are only two differences between a procedure and a function.
(1) A function must return a value
(2) because of (1) we can use functions in SQL statements.
There are some minor difference in allowable syntax but they are to do withj RETURN values.
Cheers, APC -
Stored procedure and function - return table type
Hello again :)
I have one simple question :) Maybe on this forum the question was asked, but I found only similar question and they didn't help me.
It's possible return in Stored Function (with StoredProcedureFunction) as result return TABLE type? Or return table type with output parametr with Stored Procedure? Or instead of the table return the db object, but it is similar problem:)
Now, I can using db types TABLES or DB OBJECTS as INPUT parameters with call stored functions or procedures, for example:
I have this simple db object:
create or replace type BUFFER_DATA_R as object( detail VARCHAR2(4000 ))
And this simple table:
CREATE OR REPLACE TYPE BUFFER_DATA_T IS TABLE OF BUFFER_DATA_R
I create simple domain class object:
*public class DMBufferDataStruct {*
public String bufferData;
And I mapped in java with ObjectRelationalDataTypeDescriptor:
ObjectRelationalDataTypeDescriptor descriptor = new ObjectRelationalDataTypeDescriptor();
descriptor.setJavaClass(DMBufferDataStruct.class);
descriptor.setTableName("BUFFER_DATA_T");
descriptor.setStructureName("BUFFER_DATA_R");
descriptor.setPrimaryKeyFieldName("DETAIL");
descriptor.addFieldOrdering("DETAIL");
descriptor.addDirectMapping("bufferData", "DETAIL");
and join to server session ...
Well, i using this doimain class object as input parametr wih stored procedure call:
ObjectRelationalDatabaseField ordf = new ObjectRelationalDatabaseField("");
ordf.setSqlType(Types.STRUCT);
spCall.addNamedArgument(key, key,
Types.ARRAY,
"BUFFER_DATA_T",
ordf);
query.addArgument(key);
args.add(paramsInputs.get(key));
in paramsInputs is Vector of DMBufferDataStruct...
Well, this work fine!
But I can not figure, how to return this table from output parameters of stored procedure or as a return value from stored function?
Example of exceptions:
The number of arguments provided to the query for execution does not match the number of arguments in the query definition. - return as output parameter
PLS-00382: expression is of wrong type - used as result from stored function
So, my question is: Is possible return this table type from stored procedure or function? And if YES, how can I set output argument for call?
Thx advance!
Sorry for my English! :)
Best regards, KLDYour question is: what is faster PL/SQL or PL/SQL? And the answer is: it is PL/SQL of course!
As a general rule, you use a function when you return exactly one result: a number or a string or (more complex) instance of an object type or REF CURSOR or PL/SQL collection.
You use a procedure when:
a) you just do the job and return no result
b) you return multiple results - you can use multiple IN/OUT or OUT parameters
Imagine you have to write a program unit that performs a partitioned table maintenance by adding a partition.
You can implement this unit:
a) if you want return a "status code" (0 on successful completion or non-zero in case of error) then you should use a function
b) if you want no "status code" (in case of error an exception is raised that is handled outside of the program unit) then you should use a procedure
c) if you want "status code", name of tablespace where a partition was created (assume you program is so complex that it can choose different tablespaces based on metadata and free space available) and free space in that tablespace after the creation of a new partition then you should use a procedure with 3 OUT parameters.
But these are good programming practices that can be applied to (almost) any 3rd generation programming language, not only PL/SQL. -
Without calling stored procedure or functions from database
Hi,
I am using Jdeveloper 11.1.1.5.0.
=>How to do PL/SQL procedures and functions in ADF without calling stored procedure or function from DB?S, PL/SQL procedures and functions are done in Application Module class or in managed bean..By calling the stored procedures or functions from DB.
But I am asking how to do if DB doesn't have any procedures,triggers and functions. -
Create stored procedure or function of pl/sql in jdeveloper
How can we create a stored procedure or function of pl/sql in jdeveloper 11.1.2.1.0? And how it will be called? Please help me?
Edited by: mrs on 4 Jul, 2012 3:07 AMI am a beginner to jdeveloper and adf so please give a step by step method for how to create a stored procedure of pl/sql in jdeveloper 11.1.2.1.0
-
How can I get a list of values (one or more) used in the WHERE filter of stored procedures and functions in SQL Server?
How can get a list of values as shown (highlighted) in the sample stored procedure below?
ALTER PROC [dbo].[sp_LoanInfo_Data_Extract] AS
SELECT [LOAN_ACCT].PROD_DT,
[LOAN_ACCT].ACCT_NBR,
[LOAN_NOTE2].OFCR_CD,
[LOAN_NOTE1].CURR_PRIN_BAL_AMT,
[LOAN_NOTE2].BR_NBR,
INTO #Table1
FROM
dbo.[LOAN_NOTE1],
dbo.[LOAN_NOTE2],
dbo.[LOAN_ACCT]
WHERE
[LOAN_ACCT].PROD_DT = [LOAN_NOTE1].PROD_DT
and
[LOAN_ACCT].ACCT_NBR = [LOAN_NOTE1].ACCT_NBR
and
[LOAN_NOTE1].PROD_DT = [LOAN_NOTE2].PROD_DT
and
[LOAN_NOTE1].MSTR_ACCT_NBR = [LOAN_NOTE2].MSTR_ACCT_NBR
and
[LOAN_ACCT].PROD_DT = '2015-03-10'
and
[LOAN_ACCT].ACCT_STAT_CD IN
('A','D')
and
[LOAN_NOTE2].LOAN_STAT_CD IN
('J','Z')
LenfinkelHi LenFinkel,
May I know what is purpose of this requirement, as olaf said,you may parse the T-SQL code (or the execution plan), which is not that easy.
I have noticed that the condition values in your Stored Procedure(SP) are hard coded and among them there is a date values, I believe some day you may have to alter the SP when the date expires. So why not declare 3 parameters of the SP instead hard coding?
For multiple values paramter you can use a
table-valued parameter. Then there's no problem getting the values.
If you could elaborate your purpose, we may help to find better workaround.
Eric Zhang
TechNet Community Support -
SQLJ vs JDBC vs stored procedur?People
SQLJ vs JDBC vs stored procedur?
What is used in the enterprise?
What to study?SQLJ and JDBC are ways to access the database - from the client, from the middle tier, or from inside the database server itself.
JDBC is an API specified by Sun as part of Java, while SQLJ is an ANSI (soon ISO) standard for embedding SQL in Java.
JDBC is more widespread, while SQLJ is a more productive environment.
Stored procedures are pieces of code executed in the database as part of your database session. In Oracle Databases, stored procedures are usually written either in PL/SQL (a propertietary Oracle language) or in Java. If you write your stored procedure in Java you use JDBC or SQLJ to access the database - essentially the same code you would write on the client or in a middle-tier. -
JDBC(using stored procedure) to RFC Scenario
Hi
I am doing JDBC(using stored procedure) to RFC Scenario
While running the scenario i am getting the following error
Database-level error reported by JDBC driver while executing statement 'EXECUTE EMU.EXTRACTRECON'. The JDBC driver returned the following error message: 'com.ibm.db2.jcc.a.SqlException: [ibm][db2][jcc][10100][10910] java.sql.Statement.executeQuery() was called but no result set was returned. Use java.sql.Statement.executeUpdate() for non-queries.'. For details, contact your database server vendor.
Can anybody sortout my problem
Regards
sunilreddyHi,
i am doing the scenario file to rfc scenario.
when i run my scenario xi system is picking the data from file system
but rfc is not accepting the data.this is the error i am getting
Delivery of the message to the application using connection RFC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Exception thrown in method process. The transaction is marked for rollback.: com.sap.engine.services.ejb.exceptions.BaseTransactionRolledbackLocalException: Exception thrown in method process. The transaction is marked for rollback..
so please any one give me the solution for that -
Problem with Stored Procedure exection in Sender and Receiver side of JDBC
Hi All,
I am facing problem while executing Stored Procedures using sender and receiver sides of JDBC adapter.
Here is my SP in Oracle DB :
PROCEDURE EMP
( ID IN VARCHAR2,NAME IN VARCHAR2,PROCESSED IN VARCHAR2 ) AS
BEGIN
INSERT INTO EMPLOYEE VALUES (ID, NAME, PROCESSED);COMMIT;END EMP;
Now I want to execute this SP using sender JDBC channel and receiver JDBC channel.
Can anyone please help me executing this SP?
Regards,
SooryaHi Soorya,
The receiver Data type should be like this:
<StatementName>
<storedProcedureName action=u201D EXECUTEu201D>
<table>realStoredProcedureeName</table>
<param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
</storedProcedureName >
</StatementName>
Check the link http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
Which DB are you using?? The sender structure will be like
<resultset>
<row>
<field1></field1>
<field2></field2>
<field3></ field3>
</row>
</resultset>
Search SDN you will get lot of examples
Regards
Suraj -
JDBC Sender With Stored Procedure & Context Handeling
Hi All,
In my scenario i am using stored Procedure in JDBC sender adapter for Fetching data,
I am fetching data from 3 tables kepping a one key element Exampkle <matnr> for each value in this <matnt> in table 1 i will fetch the corresponding records in table 2 and 3 ...
how can i use context in mapping such a sender structure to hendle the emplty value ...give me some idea...
if any one has come across such situation plz help me ....it very urgent .
thanks
ShakifHi,
Follow this
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
JDBC adapter
/people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter
stored procedure
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
Helpful link
http://help.sap.com/saphelp_nw04/helpdata/en/45/023c41325fa831e10000000a1550b0/frameset.htm
Might help you..
vasanth. -
Problem with Stored procedure in JDBC Synch scenario
Hello Experts,
I am working on the scenario which is from HTTP <-> to <-> JDBC. It is a synchronouse scenario. We are using Stored procedure in this scenario.
1) Please send the response structure for it.
2) here when i am sending request to the Database it is giving me below error :
Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'TCS.PKG_BMF_MANAGE_SERVICE_DATA.PROC_GET_ACTIVE_MF_ESIIDS' (structure 'statement'): java.sql.SQLException: Oracle CLOB Helper: java.lang.AbstractMethodError: java/sql/Clob.setString(JLjava/lang/String;)I. Setting message to status failed.
One of the field in Database stored procedure is of type CLOB. So can you ppl guide me that what might be the solution for this.
Any help appriciated.
Thanks,
HetalI am using Stored procedure and that is working fine in Oracle
This is my XI Request structure :
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:read_PROC_GET_ACTIVE_ESIIDS xmlns:ns0="http://reliant.com/xi/BMFR2">
- <statement>
- <PROC_GET_ACTIVE_ESIIDS action="EXECUTE">
<table>TCS.PKG_BMF_MANAGE_SERVICE_DATA.PROC_GET_ACTIVE_MF_ESIIDS</table>
<in_bmf_partner_id isInput="true" type="VARCHAR">994</in_bmf_partner_id>
<in_esids isInput="true" type="CLOB">1008901001155950587100:1008901001155950545100:1008901001155950671100:1008901001155950114100</in_esids>
</PROC_GET_ACTIVE_ESIIDS>
</statement>
</ns0:read_PROC_GET_ACTIVE_ESIIDS>
This is oracle Stored procedure signature :
PROCEDURE PROC_GET_ACTIVE_ESIIDS
in_bmf_partner_id IN kss_activity_stg_curr_stat.BMF_PARTNER_ID%TYPE,
in_esids IN CLOB,
out_recordset OUT sys_refcursor
Let me know if you need any further information.
Thanks,
Hetal
Maybe you are looking for
-
I am unable to see business systems in ID
Hi Experts, I have created Technical and business systems in SLD, I have done mapping every thing working fine but when go to integration directory i am unable assign business systems, i didn't find my busuiness systems in ID. Can u please tell me wh
-
Hi , I need to download a login banner page on our WLC 5508 version 7.4.100.60 but i am getting error and the logs is showing the following : *TransferTask: Sep 11 11:05:04.248: #CLIWEB-3-BUFFER_TOO_LONG: cli_web_api.c:3240 Buffer for Login Ban
-
Install of PC Suite causes restart of Windows
I have windows 2000 sp4 and am installing the latest version of the PC Suite MSI and every time I try runing the installer it gets to the page where the installation begins, waits about two or three seconds, the screen hoes black and windows restarts
-
LDAP + create homedir after changeip failure
Hi all I have a vertically mounted Xserve running 10.4 and have some troubles. When I tried using changeip to change the server name of my xserve things started to become funky. This is what I did: * saw errors about DNS name in log * added the serve
-
How to reinstall CRS after database has been creaed.
Hi gurus I need to reinstall the CRS because I used wrong IP alias when privious installation.The database has been created and put into the test enviroment. I am required to reinstall the CRS without affecting the database normal running. How to ach