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.

Similar Messages

  • Synch JDBC Receiver - stored procedure

    Hi All ,
    Can you please let me know whether we can go for a Synch JDBC receiver which needs to excute a stored procedure at the target DB system ?  If Yes , Please let me know the procedure .
    Thank you.
    Regards,
    Midhu

    hi midhu,
    Yes you can use stored procedure in receiver JDBC,Set  action field to execute and for table field map to Stored procedure name.
    Please refer
    /people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    Regds,
    Srinivas

  • 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
    sunilreddy

    Hi,
    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

  • 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.

  • JDBC Adapter - Stored procedure

    We r using JDBC adapter to do some DML operations on SQL DB tables. We got some errors.
    Now we have decided to use a stored procedure for the same.
    Any ideas on this. Any source is appreciated.
    -Naveen.

    Hi Naveen,
    First refer this blog-
    http://help.sap.com/saphelp_nw04/helpdata/en/45/023c41325fa831e10000000a1550b0/frameset.htm
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Hope this helps,
    Regards,
    Moorthy

  • Deploying SQLJ classes as Java Stored Procedures using JDeveloper 10g

    Hello,
    I have defined a SQLJ class, MwaSqljDao.sqlj, in JDeveloper. When I right click on the SQLJ class and "make" the class. It appears to succeed.
    However when I attempt to build the project in which the SQLJ class is a member of, a class that uses the SQLJ class has the following compile error:
    - MwaSqljDao not found.
    After a little digging it appears JDeveloper is able to compile the .sqlj file to a .java file in the classes output directory. However it does not take it to the next step of compiling the .java file into a .class file.
    Is SQLJ still a main stream Oracle technology? Or has it been cast to way side to make way for other technology?
    If SQLJ is still a supported Oracle technology how do go about compiling the SQLJ class using JDeveloper?
    My goal is to deploy SQLJ into JServer as a Java Stored Procedure class.
    Thank you,
    Rob

    Excellent.
    Especially that you resolved it and even more so that you posted the solution.
    I do wonder whether you would have gotten help (faster) has you asked in a JDeveloper-related forum such as " Forum Home » Developer Tools » JDeveloper and ADF" at JDeveloper and ADF

  • 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:
    &#9679;     Specify a valid SQL SELECT statement to select the data to be sent from the specified database.
    &#9679;     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  Adapter Stored Procedure Query

    Hi All,
    I hav a scenario where i hav to call a Stored procedure. The stored procedure returns 3 result set objects (in other words, has 3 select statements). I had configured a JDBC Sender adapter which contains the Execute statement of the Stored Procedure. When i run this scenario, i'm not getting anything displayed on the SXMB_MONI. the adapter is in green color in the Adapter monitor.Can any one help me out in this regard?
    Thnx in Adv
    Anil

    Anil,
    Did you check your Data Type is created correctly ?
    And check the link, I have provided.
    And first try to retrieve the 1 resultset. And check is it coming to XI.
    Also check in the RWB->Message Monitoring->Select the Criteria->Audit Log.... You can check is there any error..
    Just look into this also-DataType definition for when using JDBC sender adapter
    configuring jdbc adapter with multiple tables
    Hope this helps,
    Regards,
    Moorthy

  • JDBC-FILE(Stored procedure)

    HI Experts,
    I have a requirement as follows
    stored procedure->stored procedure->File.
    ie initially a stored procedure would be executed(which i could execute with help of option in the jDBC communication channel).This would result in a resultset being given as output.
    This will be associated with sender datatype.Now this is to be given as input to a second stored procedure.
    The second stored procedure will return output which i need to map into a target file structure.
    Can anybody guide me in this regard?Sender will be JDBC and target will be file adapter,but how can i execute the second stored procedure?
    The blogs simply says the option for one stored procedure to file.Is there any other help or blogs?
    Thanks in advance

    Hi,
    According to your requirement you are clubbing three scenarios into one:
    1) Source > XI <> JDBC(SP1)
    2) Continued from (1) JDBC(SP1) >XI <> JDBC(SP2)
    3) Continued from (2) JDBC(SP2) -->XI --> File.
    Now you can decide what all objects you will need....the trick lies in how you are going to configure the Directory part for this.....
    Include the necessary conditions in Receiver Determination (for sending message in the second point mentioned).....
    The second communication should get iniated once you get some value from the call to SP1....this can be checked in Receiver Determination using the Exist (EX) condition...this will trigger the call to SP2.....same for SP2-----> File.
    Just create a single Configuration Scenario in ID for this and include all the objects in it.
    Regards,
    Abhishek.

  • JDBC Adapter stored procedure call

    Hi All,
    I have a requirement of calling stored procedure through Reciever JDBC Adapter, where in multiple records are to be provided as input at a time, also multiple records should be recieved at a time.
    Can any one tell me how the structure of data type should be.
    Thank in Advance,
    With Regards,
    Zafar Ali

    Hello Ali,
                     At structure level, the root node should set to  0..unbound as we intend to process multiple records, if the records are having same structure.
    [Jdbc scenario|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417800)ID1319542550DB11163633639799272972End?blog=/pub/wlg/1772]
    Regards,
    prasanna

  • Jdbc receiver stored procedure call

    This is my stored procedure in sybase
    create procedure fn_acf2
        @proj_name   char(4),
        @ver         char(1),
        @function_code char(4),
        @ident_number char(9),
        @agent_id     char(6)               
        as
        declare @msg char(30)
        declare @return_code int
        declare @str_return char(5)
    begin
        if @ver != "1"
           begin
             print "Invalid version number for 'FNA2'"
             return(-1)
           end
           execute @return_code = SGW003...fn_acf2_security @proj_name, @ver, @function_code, @ident_number, @agent_id
           if @@error != 0
             begin
               select convert(char(5),@return_code)
             end
        else
           return (@return_code)
    end
    go
    MY REQUEST structure looks like
    MT_Sybase_Request
    statement (element of MT_Sybase_Request)
    fn_acf2 (element of statement)
    action (attribute of fn_acf2) ( have hard coded as EXECUTE)
    proj_name(element of fn_acf2)
    type (attribute of proj_name) hard coded as char
    isInput (attribute of proj_name) hard coded as 1
    ver(element of fn_acf2)
    type (attribute of ver) hard coded as char
    isInput (attribute of ver) hard coded as 1
    funtion_code(element of fn_acf2)
    type (attribute of function_code) hard coded as char
    isInput (attribute of function_code) hard coded as 1
    ident_number(element of fn_acf2)
    type (attribute of ident_number) hard coded as char
    isInput (attribute of ident_number) hard coded as 1
    agent_id(element of fn_acf2)
    type (attribute of agent_id) hard coded as char
    isInput (attribute of agent_id) hard coded as 1
    Should i put element name under statement as fn_acf2  or fn_acf2_security
    Is the above structure correct?
    I have followed these blogs
    JDBC Stored Procedures
    SYNCHRONOUS SOAP TO JDBC - END TO END WALKTHROUGH

    all elements are under fn_acf2
    but i want you guys look my Stored procedure
    execute @return_code = SGW003...fn_acf2_security @proj_name, @ver, @function_code, @ident_number, @agent_id
    in the above stmt,
    iam confused why it fn_acf2_security was used instead of an_acf2 ( fn_acf2 is my Stored procedure name)
    what does execute @return_code mean ( actually return_code is my response structure element)
    my response wil have only elemnt which is return_code.

  • JDBC callableStatement stored procedure call cancellation?

    up vote0down votefavorite
    I have a very complex oracle stored procedure that searches and retrieves some data. The procedure returns an output parameter - an oracle cursor. I execute the procedure by JDBC:
    CallableStatement stmt = conn.prepareCall("{call myprocedure(?,?,?,?}");
    The problem is, the queries can sometimes take quite long (few minutes) and i would like user to be able to cancel the query anytime by clicking button. I have reference to stmt object, but unfortunatelly calling stmt.cancel() (from other thread) has NO EFFECT.
    On the other hand when i change the CallableStatement sql to some query like:
    CallableStatement stmt = conn.prepareCall("select * from all_objects");
    i get "java.sql.SQLTimeoutException: ORA-01013: user requested cancel of current operation" after calling stmt.cancel() - so thats the right reaction.
    Does that mean than i cannot cancel stored procedure call via jdbc, but only simple select statements? Does anyone else had and resolved similar problem?
    I guess i could cancel the query by oracle kill session, but i use connection pooling (jboss) and i have plenty of sessions for the same user existing.
    Database Product Version is Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production JDBC Driver Version is 11.2.0.4.0
    any help will be appreciated.

    This property didnt help, still no reaction after statement.cancel().
    I could not cancel the statment from the db size , so i decided to spawn new java thread and run the statement in that thread, and when user clicks cancel button i just cancel the thread, some snipper of code below:
                   AtomicBoolean userCanceled - this must be AtomicBoolean or  volatile variable, so other threads would see the change of variable after clicking button
                   try{
                    MyCallableQuery callable = new MyCallableQuery(rs,stmt,this,rsh,outParameter);
                    FutureTask<T> queryTask = new FutureTask<T>(callable);
                    ExecutorService executor = Executors.newFixedThreadPool(1);
                    executor.execute(queryTask);                 
                    while  (!queryTask.isDone()){         //stil processing statement            
                     Thread.sleep(100);
                          if (userCanceled)){               //user decided to cancel
                           futureTask1.cancel(true);
                           executor.shutdown();
                           throw new SQLException("User decided to cancel procedure call");
                     result = futureTask1.get(); 
                     //here the code after the resultset has been processed without cancelation
                   catch (SQLException e}{
                   //here the code when user decided to cancel  like clearing the datatable
    and my callable class is like:
    public class MyCallable<T> extends ProcRunner implements Callable<T> {
        private ResultSet rs;
        private CallableStatement stmt;
        private ProcRunner procRunner;
        private ResultSetHandler<T> rsh;
        private Integer outParameter;
        public MyCallable(ResultSet rs,CallableStatement stmt,ProcRunner procRunner,ResultSetHandler<T> rsh,Integer outParameter){
            this.rs = rs;
            this.stmt = stmt;
            this.procRunner = procRunner;
            this.rsh = rsh;
            this.outParameter = outParameter;
        @Override
        public T call() throws Exception {
           T result = null;     
          stmt.executeUpdate();
           rs = (ResultSet) stmt.getObject(outParameter);
           rs = this.wrap(rs);
           result = rsh.handle(rs);  
        return result;

  • JDBC Receiver, Stored Procedure that Deletes

    Hi,
    I have a stored procedure that deletes fields in a table based on a lot of different criteria.
    I can't use DELETE or SQL_QUERY ie Statement3 and 6 in http://help.sap.com/saphelp_nw04s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm . I can only use this Stored Procedure.
    This is my message type.
    <MT_HEADER>
        <Statement>
             <ClearTable>
                 <action>.......attribute...set to EXECUTE
                  <table> .......maps to Stored Procedure
                  <isInput>  ......attribute... set to TRUE
                  <type>   ........attribute...set to STRING
    However, I'm getting this error
    ERROR: Invalid XML document format for stored procedure: 'type="<SQL-type>"' attribute is missing for element 'table' (Setting a SQL-type (e.g. INTEGER, CHAR, DATE etc.) is mandatory !)
    Any ideas?

    Damien,
    If you look in the link you have procided, the datatype for Stored Procedure every element needs to have a TYPE attribute asscoiated with it and you need to give the corresponding Datatype of that element,
    <i>The attribute type=<SQL-Datatype> , which describes the valid SQL data type, is mandatory for all parameter types (IN, OUT, INOUT).
    The following SQL data types are supported:
    INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output),CLOB (input and output), CURSOR (output; only in conjunction with the Oracle JDBC driver).
    </i>
    Regards
    Bhavesh

  • Idoc to Jdbc using stored procedure

    Greetings All,
      In my scenario i want to send the idoc from SAP system to SQL database using the stored procedure. I want ack back from JDBC adapter when the record is sucessfully inserted in DB table. There after i can update the status of idoc sent in source SAP system. Can anyone suggest me how to achive this since its seems to like a syncronous scenario. Can we achive this without stored procedure i.e. calling Insert_Update statement
    Many thanks,
    Sandip

    Hi,
    Go through this thread
    Re: XI IDoc Acknowledgement - Acknowledgement not possible status
    Regards
    Laxmi Bhushan

  • JDBC adapter Stored Procedure error: parameter was not supplied

    I am trying to call a Stored Procedure 'SP_FUSION_DEBMS_ADRC_MANAGE_CUSTOMER_ADDRESS' in our SQL Server database.
    XI 3.0 Sp13
    Jdbc Url: jdbc:microsoft:sqlserver://161.241.255.91:1433;databaseName=FusionDB;SelectMethod=Cursor
    I am getting following error:
    beging of error-----
    Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_FUSION_DEBMS_ADRC_MANAGE_CUSTOMER_ADDRESS' (structure 'Statement1'): java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Procedure 'SP_FUSION_DEBMS_ADRC_MANAGE_CUSTOMER_ADDRESS' expects parameter '@control_no', which was not supplied.
    End of error-----
    I have defined the field "control_no" in the interface defenition but I am not sure what causing this error, error message is mis-leading.
    Please let me know if you have any hints/comments?
    thanks,
    Laxman molugu

    Hi Laxman,
    maybe you have checked this already...from the following help link....DECIMAL might be something you might want to try out....
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
    <i>action=EXECUTE
    Statements with this action result in a stored procedure being executed. The name of the element is interpreted as the name of the stored procedure in the database. If you use the optional <table> element, the value specified here is used as the stored procedure name. This enables you, for example, to define stored procedure names containing non-XML-compatible characters or characters that prevent them from being used in interface definitions in the Integration Builder/PCK.  If specified, <table> must be the first element in the block within <dbTableName>.
    The elements within the stored procedure are interpreted as parameters. They can optionally have the attribute isInput=“1“ (input parameter) or isOutput=“1“ (output parameter) or both (INOUT parameter). If both attributes are missing, the element is interpreted as an input parameter. The parameter names must be identical to those of the stored procedure definition.
    The attribute type=<SQL-Datatype> , which describes the valid SQL data type, is mandatory for all parameter types (IN, OUT, INOUT).
    The following SQL data types are supported:
    INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output),CLOB (input and output), CURSOR (output; only in conjunction with the Oracle JDBC driver).</i>

Maybe you are looking for

  • My firefox wont open

    All of a sudden Firefox won't open. I click on the icon in my start menu/ taskbar and nothing happens. This was working perfectly fine about half an hour before this. I've already checked the task manager and firefox is not open in the process window

  • How do I hide my IP?

    Hello... I want to learn how to hide my IP and domain information when chatting in IRC clients or using Flash based IRC chats? I've tried using Proxy sites, but they don't work. Thank you for any information anyone can provide!

  • Experienced Java developer needed

    We are looking for an experienced java developer to assist us with an existing web based applet project. The developer should have expertise in creating web friendly applets designed with JRE compatibility in mind. The current applet will allow users

  • Moving a movie clip via key press event question.

    I have a project where I'm trying to move the movie clip: "wally", up and down three levels of a stage. However, from the default position I have him move up 145 pixels, and down 120 pixels. I want to limit this action to one use, meaning if wally go

  • Crreate Dynamic report in Swing using selectionFormula of ReportViewerBean

    I'm working on a desktop application using ReportViewerBean from Crystal Reports XI release 2. I've a working app which can show, print and export reports. What I need now is to pass a selectionFormula to filter the records my report will read. viewe