Oracle Function call from JDBC Adapter
Hi,
Is it possible to call Custom Oracle Function from JDBC Adapter?
I know we can call stored procedure but I need to call Oracle function. Please explain how?
Regards,
Shweta.
You'll need to provide a column alias for the function call:
select func(val) as alias from dual
Similar Messages
-
Oracle function call from XSQL
Hi, Steve,
We have trouble to make a function call in XSQL. Here is what we have.
Function:
create or replace function VerifyUser (valid in varchar2)
return varchar2
is
begin
return(valid);
end;
XSQL call:
<PAGE xmlns:xsql="urn:oracle-xsql" connection="demo" istrue="ISTRUE">
<xsql:query>
select VerifyUser('{@istrue}') from DUAL
</xsql:query>
</PAGE>
Error message returned:
<PAGE istrue="ISTRUE">
<ERROR>oracle.xml.sql.OracleXMLSQLException: Invalid character in name.</ERROR>
</PAGE>
Any idea what is wrong here?
What we want is to get the out variable value onto the XSQL page.
Thanks for help.
nullYou'll need to provide a column alias for the function call:
select func(val) as alias from dual -
Java function call from Trigger in Oracle
Moderator edit:
This post was branched from an eleven-year-old long dead thread
Java function call from Trigger in Oracle
@ user 861498,
For the future, if a forum discussion is more than (let's say) a month old, NEVER resurrect it to append your new issue. Always start a new thread. Feel free to include a link to that old discussion if you think it might be relevant.
Also, ALWAYS use code tags as is described in the forum FAQ that is linked at the upper corner of e\very page. Your formulae will be so very much more readable.
{end of edit, what follows is their posting}
I am attempting to do a similar function, however everything is loaded, written, compiled and resolved correct, however, nothing is happening. No errors or anything. Would I have a permission issue or something?
My code is the following, (the last four lines of java code is meant to do activate a particular badge which will later be dynamic)
Trigger:
CREATE OR REPLACE PROCEDURE java_contact_t4 (member_id_in NUMBER)
IS LANGUAGE JAVA
NAME 'ThrowAnError.contactTrigger(java.lang.Integer)';
Java:
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ThrowAnError" AS
// Required class libraries.
import java.sql.*;
import oracle.jdbc.driver.*;
import com.ekahau.common.sdk.*;
import com.ekahau.engine.sdk.*;
// Define class.
public class ThrowAnError {
// Connect and verify new insert would be a duplicate.
public static void contactTrigger(Integer memberID) throws Exception {
String badgeId;
// Create a Java 5 and Oracle 11g connection.
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
// Create a prepared statement that accepts binding a number.
PreparedStatement ps = conn.prepareStatement("SELECT \"Note\" " +
"FROM Users " +
"WHERE \"User\" = ? ");
// Bind the local variable to the statement placeholder.
ps.setInt(1, memberID);
// Execute query and check if there is a second value.
ResultSet rs = ps.executeQuery();
while (rs.next()) {
badgeId = rs.getString("Note");
// Clean up resources.
rs.close();
ps.close();
conn.close();
// davids badge is 105463705637
EConnection mEngineConnection = new econnection("10.25.10.5",8550);
mEngineConnection.setUserCredentials("choff", "badge00");
mEngineConnection.call("/epe/cfg/tagcommandadd?tagid=105463705637&cmd=mmt%203");
mEngineConnection.call("/epe/msg/tagsendmsg?tagid=105463705637&messagetype=instant&message=Hello%20World%20from%20Axium-Oracle");
Edited by: rukbat on May 31, 2011 1:12 PMTo followup on the posting:
Okay, being a oracle noob, I didn't know I needed to tell anything to get the java error messages out to the console
Having figured that out on my own, I minified my code to just run the one line of code:
// Required class libraries.
import java.sql.*;
import oracle.jdbc.driver.*;
import com.ekahau.common.sdk.*;
import com.ekahau.engine.sdk.*;
// Define class.
public class ThrowAnError {
public static void testEkahau(Integer memberID) throws Exception {
try {
EConnection mEngineConnection = new EConnection("10.25.10.5",8550);
} catch (Throwable e) {
System.out.println("got an error");
e.printStackTrace();
}So, after the following:
SQL> {as sysdba on another command prompt} exec dbms_java.grant_permission('AXIUM',"SYS:java.util.PropertyPermission','javax.security.auth.usersubjectCredsOnly','write');
and the following as the user
SQL> set serveroutput on
SQL> exec dbms_java.set_output(10000);
I run the procedure and receive the following message.
SQL> call java_contact_t4(801);
got an error
java.lang.NoClassDefFoundError
at ThrowAnError.testEkahau(ThrowAnError:13)
Call completed.
NoClassDefFoundError tells me that it can't find the jar file to run my call to EConnection.
Now, I've notice when I loaded the sdk jar file, it skipped some classes it contained:
c:\Users\me\Documents>loadjava -r -f -v -r "axium/-----@axaxiumtrain" ekahau-engine-sdk.jar
arguments: '-u' 'axium/***@axaxiumtrain' '-r' '-f' '-v' 'ekahau-engine-sdk.jar'
creating : resource META-INF/MANIFEST.MF
loading : resource META-INF/MANIFEST.MF
creating : class com/ekahau/common/sdk/EConnection
loading : class com/ekahau/common/sdk/EConnection
creating : class com/ekahau/common/sdk/EErrorCodes
loading : class com/ekahau/common/sdk/EErrorCodes
skipping : resource META-INF/MANIFEST.MF
resolving: class com/ekahau/common/sdk/EConnection
skipping : class com/ekahau/common/sdk/EErrorCodes
skipping : class com/ekahau/common/sdk/EException
skipping : class com/ekahau/common/sdk/EMsg$EMSGIterator
skipping : class com/ekahau/common/sdk/EMsg
skipping : class com/ekahau/common/sdk/EMsgEncoder
skipping : class com/ekahau/common/sdk/EMsgKeyValueParser
skipping : class com/ekahau/common/sdk/EMsgProperty
resolving: class com/ekahau/engine/sdk/impl/LocationImpl
skipping : class com/ekahau/engine/sdk/status/IStatusListener
skipping : class com/ekahau/engine/sdk/status/StatusChangeEntry
Classes Loaded: 114
Resources Loaded: 1
Sources Loaded: 0
Published Interfaces: 0
Classes generated: 0
Classes skipped: 0
Synonyms Created: 0
Errors: 0
.... with no explanation.
Can anyone tell me why it would skip resolving a class? Especially after I use the -r flag to have loadjava resolve it upon loading.
How do i get it to resolve the entire jar file?
Edited by: themadprogrammer on Aug 5, 2011 7:15 AM
Edited by: themadprogrammer on Aug 5, 2011 7:21 AM
Edited by: themadprogrammer on Aug 5, 2011 7:22 AM
Edited by: themadprogrammer on Aug 5, 2011 7:23 AM
Edited by: themadprogrammer on Aug 5, 2011 7:26 AM -
Execute Oracle Package Function call from FORTE
Has anyone EVER successfully execute an Oracle Package Function call from FORTE
via " sql execute procedure "?
Here's my question, I am able to execute a stored procedure but hasn't figured
out a way to execute a function which defined in a package. The syntax goes
like this: sql execute procedure <PackageName>.<FunctionName> ( input
input_parm, output output_parm). If anyone EVER successfully execute a
function, please let me know, thanks.You'll need to provide a column alias for the function call:
select func(val) as alias from dual -
Where to see generated SQL statement from jdbc adapter?
Hi everybody,
where can I see the generated SQL statement from JDBC adapter?
Regards MarioYes and True lterally means the same, but alas XI does not understand literature..
Just checked the note as well, as you are correct!
Regards
Bhavesh -
Stored Procedure call from JDBC sender for Oracle Database
Hi,
I have a requirement to call stored procedure using JDBC sender adapter for retriving data from an Oracle database.
I need to execute first stored procedure call from Querry SQL statement and then trigger second stored procedure call for confirming the succesful retrival of those records from the update SQL statement.
Querries:
1. Can we trigger stored procedure from Update statement of JDBC sender.
2. Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
3. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
Please note PI does not have direct access to main table and hence the need to have separate stored procedure calls.
The PI version is PI 7.11 sp4.
Appreciate your inputs.
Thanks.
Siddhesh S.Tawate>1. Can we trigger stored procedure from Update statement of JDBC sender.
I think not possible using update statement.
> Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
Yes using select query you can call stored procedure.
>. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
No select and update handles in the same session using the same thread so if one transaction fails update should not proceed. -
Calling Stored Procedure from JDBC Adapter
Hello,
I am Updating a SQL Server Table using JDBC Adapter.
Now I have multiple input rows and the procedure needs to be called for each set.
Do I need to use multimapping for this or just generating multiple <b>Statement</b> node will solve?
Also For this will there is any knows/ forseen problem (like Transaction handling) that I need to take care of?
Thanks and Regards,
Himadri
Message was edited by:
Himadri ChakrabortyHimadri,
You can just create multiple statement nodes in one message.
I am not aware of any known or foreseen issues with this approach.
Kind regads,
Koen -
Invoke stored procedure from JDBC Adapter
Is there a tool that generates interfaces for stored procedure(ORACLE PL/SQL) like RFC or IDOC adapters?
Hi Denis,
I dont think there is any such tool.]
To generate a Stored Procedure of your Oracle DB, all you will have to do in your <b>JDBC adapter configuration</b> is give the name of the Stored Procedure under <Table> and you will have to give "<b>execute</b>" as the value under action attribute.
Just check this link. Hope it helps,
http://help.sap.com/saphelp_nw04/helpdata/en/b0/676b3c255b1475e10000000a114084/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/content.htm
Just check this blog of Sriram wherein a stored procedure of a MaxDB Database is called.
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
I have implemented a scenario which requires an Oracle stored procedure to be executed and so, if you do need any further info, let me know.
Hope this info helps,
Regards,
Bhavesh -
Sending Idoc to oracle table Emp usering JDBC Adapter
Hi Guys,
Can you help me in these when we are pass a message through idoc to Oracle through jdbc adacpter reaciver
what sort of syntax Parameter need to write in
SQLSyntaxParameters Box in ID.
Regd's
RajHi Raj,
You need to insert data from the IDoc to the Oracle Database. In this case the XML that is being sent to the Receiver JDBC Adapter should be correct.
The format for this can be obtained from the following link:
http://help.sap.com/saphelp_nw2004s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
Once this is correctly done nothing needs to be mentioned in the SQLSyntaxParameters Box in ID. U can leave the default values as it is.
Regards
Neetu -
Hibernate: Oracle function call
Hi,
I want to call a oracle function through Hibernate.
Can you please tell me steps how i can achieve the same.
What ever i have read, i am mentioning below. Please let me if i am wrong
1. Create a class TestFunction.java having getter setter methods
2. Create TestFunction.hbm.xml which will be having following code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<sql-query name="callFunction" callable="true">
<return class="TestFunction">
</return>
{ call TestFunctionSQL(?, :Name, :Age) }
</sql-query>
</hibernate-mapping>I just copy pasted the code from some website and modified as per my need. Please let me know if anything is wrong above.
3. I need to put the entry of TestFunction.hbm.xml in hibernate-cfg.xml
4. I need to put the code in java to call teh stored proc. I dont have any idea how to do that.
Please help
~AmanBefore beginning : sorry if my answer isn't relevant but you asked no clear question
I don't know a lot about it, even if all looks fine to me...
the way to call a named query in hibernate is:
List l =session.getNamedQuery("callFunction")
.setString("param1", param1)
.setString("param2, param2)
.setMaxResults(50)
.list(); // named parameters are betterSEE: http://www.hibernate.org/hib_docs/v3/reference/en/html/querysql.html
specially $16.2 and $16.2.2
//extract
For Oracle the following rules apply:
* A function must return a result set. The first parameter of a procedure must be an OUT that returns a result set. This is done by using a SYS_REFCURSOR type in Oracle 9 or 10. In Oracle you need to define a REF CURSOR type, see Oracle literature. -
Applet function call from javascript
Hi,
I'm haveing a problem with accesing applet's functions from Javascript in Mozilla. IE works fine but in Mozilla I get the following error:
Error: document.applets[0] has no properties
The code used is: document.applets[0].test();
The applet has the following 2 tags defined, I don't know if they are necessary here but I'm doing the reverse too (applet functions call javascript).
<PARAM name="MAYSCRIPT" value="Y">
<PARAM name="SCRIPTABLE" value="Y">
If you have any ideea please help.
Thanksin javascript try document.getElementById("idOfTheApplet")
use object tag instead of applet tag:
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
height="300" width="450" >
<param name="code" value="appTest.class" />
<!--[if !IE]> Mozilla/Netscape and its brethren -->
<object classid="java:appTest.class"
height="300" width="450"
>
<param name="mayscript" value=Y" />
</object>
<!-- <![endif]-->
</object>or check out HtmlConverter.exe in the jdk bin dir. -
RFC function call from VB Script
I have an RFC enabled function that I need to call from VBScript. I was working through this issue as a BAPI call but after research and RFC not initialized error messages over and over I am coming to think that the issue is not how I was doing it but what I was trying to do with different objects.
I think the issue is that I was trying to call a RFC function with BAPI methods, I didnt understand that there was I difference but now I do. I don't know how to initialize the RFC on the host system and unsure if I even have all of the components on the host system to make these function calls.
The goal here is to call a function that passes 3 paramters and modifies a user object in SAP.Hello John,
are you using DCOM Connector? I have a VBScript working correctly, using DCOM Connector, and consuming a Z function module defined as RFC.
What's the error message you're getting?
Regards
Michael -
Bapi Function call from Crystal reports 2008. import parameters syntax.
Dear,
I have an issue with calling a function directly from Crystal reports (2008) in the R3 system.
(if this belongs in another thread , please add the link if moved !)
I try to get data through function "BAPI_CLASS_GET_CLASSIFICATIONS".
Till now all possible input parameters have no data-result.
I already read other threads stating that 'for example' the Language key needs to be provided in a single character. 'E' in stead of 'EN'.
I also already created a Z-wrap-function that fills out all input parameters 'hardcoded'. This works.
clearly there are som syntax changes in passing the values to R3 when called from Crystal Reports.
Can someone state which syntax has to be followed for numeric fields, for datefields etc. (so when i make these dynamical, I know which syntax should be the outcome of the formula)
in my function that doesn't work I use these selections:
(this function is called in a standard report only calling this function)
{BAPI_CLASS_GET_CLASSIFICATIONS_1.I_LANGU_ISO} = "E" and
{BAPI_CLASS_GET_CLASSIFICATIONS_1.I_LANGU_INT} = "E" and
{BAPI_CLASS_GET_CLASSIFICATIONS_1.T_CLASS_OBJECTS.OBJECT_TYPE} = "MARA" and
{BAPI_CLASS_GET_CLASSIFICATIONS_1.T_CLASS_OBJECTS.OBJECT_KEY} = "000000000000000085" and
{BAPI_CLASS_GET_CLASSIFICATIONS_1.I_CLASSNUM} = "DSWTEST" and
{BAPI_CLASS_GET_CLASSIFICATIONS_1.I_CLASSTYPE} = "001" and
{BAPI_CLASS_GET_CLASSIFICATIONS_1.I_KEY_DATE} = Date (2011, 08, 05)
I already tried other languages or the 'EN' as input.
(I would like to know how the date is passed exaclty to R3.)
The function is of course RFC enabled.
when I call the my Z-function with predefined inputparameters in R3 it does give the wanted result.
FUNCTION ZBAPI_CLASS_GET_CLASSIFICATION.
""Local Interface:
*" TABLES
*" OBJECT_CLASSIFICATION STRUCTURE BAPI_OBJECT_VALUES
*" CLASS_OBJECTS STRUCTURE BAPI_CLASS_OBJECTS
data ZOBJECT_CLASSIFICATION type TABLE OF BAPI_OBJECT_VALUES.
data ZCLASS_OBJECTS type TABLE OF BAPI_CLASS_OBJECTS WITH HEADER LINE.
ZCLASS_OBJECTS-OBJECT_KEY = '000000000000000085'.
ZCLASS_OBJECTS-OBJECT_TYPE = 'MARA'.
Append ZCLASS_OBJECTS.
CALL FUNCTION 'BAPI_CLASS_GET_CLASSIFICATIONS'
EXPORTING
CLASSTYPE = '001'
CLASSNUM = 'DSWTEST'
* KEY_DATE = SY-DATUM
* LANGU_ISO =
* LANGU_INT =
* CHARACTS_OF_CLASS_ONLY =
* IMPORTING
* RETURN =
TABLES
OBJECT_CLASSIFICATION = ZOBJECT_CLASSIFICATION
CLASS_OBJECTS = ZCLASS_OBJECTS
OBJECT_CLASSIFICATION[] = ZOBJECT_CLASSIFICATION[].
ENDFUNCTION.
please advise.
once again if this should be moved to another forum , add the link please!Dear,
I just debugged my Z-function, after adding all input parameters as in the standard BAPI function.
All parameters seems to be passed correctly except from the table parameters from
CLASS_OBJECTS
So all I_parameters are passed :
{ZBAPI_CLASS_GET_CLASSIFICATION.I_LANGU_INT} = "EN" and
{ZBAPI_CLASS_GET_CLASSIFICATION.I_LANGU_ISO} = "EN" and
{ZBAPI_CLASS_GET_CLASSIFICATION.I_KEY_DATE} = Date (2011, 08, 05) and
{ZBAPI_CLASS_GET_CLASSIFICATION.I_CLASSNUM} = "DSWTEST" and
{ZBAPI_CLASS_GET_CLASSIFICATION.I_CLASSTYPE} = "001" and
{ZBAPI_CLASS_GET_CLASSIFICATION.I_CHARACTS_OF_CLASS_ONLY.BAPIFLAG} = ""
but the table parameters aren't coming through:
{ZBAPI_CLASS_GET_CLASSIFICATION.T_CLASS_OBJECTS.OBJECT_TYPE} = "MARA" and
{ZBAPI_CLASS_GET_CLASSIFICATION.T_CLASS_OBJECTS.OBJECT_KEY} = "000000000000000085" and
these are 'blanco' in the function.
also after the function is executed and all data is retrieved, when passing the data back to Crystal reports, once again, the table result isn't passed to Crystal Reports.
please advise -
Duration of an Abap Function call from Java using Jco3
Hi guys!
I would like to use this discussion to get some refernces of the duration Timespan of an RFC call from Java to SAP. At the moment, i need at last about 200ms to call the Abap function. I'm just using one simple import and export parameter (so no deep structures). I think that the reason for my poor performance is, that the Java Tool and the SAP instance are not in the same network. So, i hope some of you have some data, how fast an RFC call from Java using Jco can be executed.
greetings, HannesHi Hannes,
I think you have already got the answer to your question - the network set-up you have is probably the bottleneck. Whenever I've worked with Java <-> ABAP and they are in the same network, I've had no performance problems at all.
Does your RFC contain any complex logic or business processes? Are you able to try and call something that does nothing, say it just accepts an input string and returns it straight away as an export. Do you have any scope for testing with your Java tool on the same network as the SAP system?
Cheers,
G. -
Java functions call from C++ App
Hi,
I'm new to Java, One of our client have generic APIs for there business logic, those are written in JAVA, now we want to use some of these APIs in C++ application. Can any one suggest/address me the better way to do this?
Thanks in advance.
Thanks,
--Ravi Kiran.To call Java functions from C++ you need a VM running in your process, and JNI is the interface you need to use in the C++ code.
One of the interfaces in JNI lets you create a VM. You generally only want one VM, so if the application started out in Java, you have a VM already and you don't need to create one.
Note that JNI is really a C <-> Java interface, and usually any C++ code called from Java is C++ 'extern "C"' functions. Java won't know anything about C++ objects. And you use JNI to get C++ to understand Java objects.
Hope this was helpful.
Maybe you are looking for
-
How do I get itunes library to move to external hard drive automatically?
I have a 250 GB Verbatim external hard drive. This hard drive has an existing itunes library from my PC. I figured out how to combine the two itunes libraries, (1 from PC and 1 from Macbook). I cannot figure out how to set up itunes to automatically
-
Discuss settings of c5 browser
when you go to default browser of this phone (nokia c5-00 3.2 mega pixel version) i.e. Options>>Settings>>Page [url=http://www.freeimagehosting.net/osaad][img]http://www.freeimagehosting.net/t/osaad.jpg[/img][/url] http://www.freeimagehosting.net/os
-
HT1414 white screen and not recognised by laptop
my ipod touch froze and has now been stuck on a pure white screen. i have connected it to the computer to try to restore it but my computer will now not recognise the ipod. what should i do?
-
Will FCP 7 import AVI video from my Nikon D90?
Will FCP 7 import AVI video directly from my Nikon D90? If not, is there a simple workaround?
-
Flashing folder and question mark on start-up... again.
I took my iMac in about two weeks ago because it froze, I did a hard restart, and when it booted back up it showed the flashing folder with a question mark. The guy who worked on it said my hard drive got messed up, and put in a new one. I just got a