Finding a stored procedure in another database

Hello,
I have a Java class that executes stored procedures. Problem is, some stored procedures are in different a whole different database than the others. When I try to cal the ones in another database I get an error stating that the SPs can't be found. How can I resolve this? I connect to the database using property files.
Any help is appreciated.

Uh...
Maybe you should connect to the database where the stored procedures are, then?

Similar Messages

  • Is it possible to calling another stored procedure in another database?

    Hello all, I hope you can help me out.
    I need to call another stored procedure in another database? Is it possible?
    I know you can call another stored procedure in the same package:
    Var_SQL :='call SP_Tes (''' || Var_1 || ''',''' || Var_2 ||''')' ;
    EXECUTE IMMEDIATE Var_SQL;
    But how do call it if its in another database? I assume, I'd have to open a new connection to it, then call it...
    Please help me. thanks

    I managed to find my synonym;
    select synonym_name, table_owner, table_name from all_synonyms where synonym_name = 'PKG_EDONWEB70'
    (BTW, its upper case sensitive, I eventually found out)
    But as you said; "anyway, what..."
    1)Crete synonym with the dblink, which is the same DB as the one I'm using:chec
    create public synonym pkg_edonweb70test2 for [email protected]
    Result: ok2)check it exists:
    select synonym_name, table_owner, table_name from all_synonyms where synonym_name = 'PKG_EDONWEB70TEST2'
    Result: ok3)check it runs in sql:
    DECLARE
        P_RETURNVALUE1 number;
    BEGIN
        PKG_EDONWEB70TEST2.SP_TESTSMB_DESTINATION ( P_RETURNVALUE1 );   
        COMMIT;
    END;
    Result: ok4)Add it to the strored procedure that is going to call it
    PROCEDURE sp_testSMB_origin(P_RETURNVALUE1 OUT number) IS
            thissql varchar(1000);      
        BEGIN
        BEGIN
            PKG_EDONWEB70TEST2.SP_TESTSMB_DESTINATION ( P_RETURNVALUE1 );   
            COMMIT;
        END;
        end sp_testSMB_origin;
    Result: FAIL; pls-00201: identifier 'PKG_EDONWEB70TEST2' must be declared

  • Reg: Find Current stored procedure status in oracle database

    Hi Gurus,
    How to find the stored procedure status in the current oracle database (ie) whether it is running or not.
    Is there any view or dbms package to find the status of the stored procedure.
    And i also want to find the last execution time of the stored procedure is there any view to find the status
    Thanks in Advance.

    Note that using DBA_HIST_SQLTEXT requires Diagnostic Pack license:
    in 10G http://download.oracle.com/docs/cd/B19306_01/license.102/b14199/options.htm#CIHGFIAF says:
    >
    All data dictionary views beginning with the prefix DBA_HIST_ are part of this pack, along with their underlying tables.
    >
    in 11G http://download.oracle.com/docs/cd/E11882_01/license.112/e10594/options.htm#CIHIHDDJ says:
    >
    All data dictionary views beginning with the prefix DBA_HIST_ are part of this pack, along with their underlying tables.The only exception are the views: DBA_HIST_SNAPSHOT, DBA_HIST_DATABASE_INSTANCE, DBA_HIST_SNAP_ERROR, DBA_HIST_SEG_STAT, DBA_HIST_SEG_STAT_OBJ, and DBA_HIST_UNDOSTAT. They can be used without the Oracle Diagnostics Pack license.

  • Exec stored procedure from another stored procedure - not working

    Hey, we've got a bunch of .sql files that we run, and some of them are stored procedures. Our programs call the stored procedures from within the .sql files and that works, but we've tried calling a stored procedure from another stored procedure and it won't compile. The syntax looks the same, and we can run that second stored procedure from the SQL*Plus command prompt just fine, so we know it's in there. It doesn't matter whether we type exec or execute in the first stored procedure--it still gives us a compilation error. Here's the relevant bit of the code:
            delete CMHISTORYINDEX;
            commit;
            exec SP_DAILY_TOTAL;
    END SP_DAILY_CLOSING;
    /Here's where we go into SQL*Plus and try to compile it:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    SQL> @sp_daily_closing.sql
    Warning: Procedure created with compilation errors.
    SQL> show errors
    Errors for PROCEDURE SP_DAILY_CLOSING:
    LINE/COL ERROR
    34/7     PLS-00103: Encountered the symbol "SP_DAILY_TOTAL" when expecting
             one of the following:
             := . ( @ % ;
             The symbol ":=" was substituted for "SP_DAILY_TOTAL" to continue.
    SQL>We've also tried changing SP_DAILY_CLOSING to lowercase, but it doesn't seem to help. As I mentioned before, we can type that same sort of thing in .sql files that are not stored procedures and the exec is compiled fine and runs correctly. What are we doing wrong?

    In the stored procedure remove "exec" :
            delete CMHISTORYINDEX;
            commit;
            SP_DAILY_TOTAL;
    END SP_DAILY_CLOSING;

  • Java Stored Procedure in one database connecting to muntiple databases.

    Hello,
    I created a Java Stored Procedure in one database(Oracle10g) and successfully open a connection to another database(Oracle10g) using Thin JDBC Driver. I want to actually transfer CLOB data from one DB to another DB. I am concern that by opening a connection another database in Java Stored Procedure, might interfere with oracle and destabilize the instance at some point. Oracle JDBC FAQ (Link: http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#34_13) stated that Yes it could be done but then mentioned the workaround.(if it could be done why do we need a workaround!!!)
    I would like to confirm whether connecting to multiple DB using JDBC Thin Driver in a Java Stored Procedure is supported by Oracle10g or not and whether it has any known issue with it.
    Thanks in Advance!
    Edited by: user649261 on Sep 16, 2008 8:05 PM

    hrishy wrote:
    Thanks i have modified the title so its easy to comprehendWrite the two parts mentioned above and post if you get problems with your code.
    First write code that calls the stored procedure and test that to make sure that it works.
    Then write a simple webservice and test it out to make sure it works. The integration should be trivial after that.

  • How to find Packaged Stored Procedure?

    Hi,
    Is there any API routine to find out if a particular StoredProcedure belongs to a package or not?? Or in the other way around , can i get to know about a list of Stored procedures a particular database package has?
    ( P.S :- getProcedures method in DatabaseMetadata gives just a list of all Standalone and Packaged procedures as one list. )
    Narendran.

    Hi,
    I have the same problem to call a stored Procedure in a Package.
    If my procedure is not in a package, everything is right.
    And I musn't indicate all the name, because I musn't put '.' in the name (of the procedure), in my DT on XI.
    It would be so nice to have an answer.
    Rémi

  • Stored procedures in PV database

    I want to create PL/SQL stored procedures in Primavera database(Oracle 8.1.7) using JDBC ODBC bridge driver which further uses system dsn PrimaveraSDK_PE(Installed by standard Primavera client).
    Whenever i try creating it, i get an error message saying syntax error near word procedure.
    Same error occurs when i try creating a table.
    Following are my connection parameters:
    odbcURL = "jdbc:odbc:PrimaveraSDK_PE"
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con1 = DriverManager.getConnection(odbcURL, "admin", "admin");
    I can create the procedures using Oracle OCI driver but using that i do not have access to all fields..so errors says..invalid column.
    following are connection parameters:
    String driverName = "oracle.jdbc.driver.OracleDriver";
         Class.forName(driverName);
              con = DriverManager.getConnection("jdbc:oracle:oci8:@sapxi","privuser","privuser");
    Since I cannot see all the fields of database through PL/SQL, I think this approach would not work. To see all the fields of database I must access it using DSN ONLY!!! Even the administrative login is not been able to show me all the fields.This is the way they have designed it....
    So whats wrong in creating the stored procedures in oracle database using JDBC ODBC bridge driver using system DSN????????
    Please help

    Thanks for your reply!!!
    Here is the code!
    import java.sql.*;
    import java.util.*;
    import java.text.*;
    class Try
    static String odbcURL = "jdbc:odbc:PrimaveraSDK_PE";
    static public synchronized Connection getConnection ()
                   throws SQLException, ClassNotFoundException
              Connection con1 = null;
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con1 = DriverManager.getConnection(odbcURL, "admin", "admin");
              return con1;
    public static void main(String[] args) throws Exception
              try
              Connection con = getConnection();
         String actionQuery = new StringBuffer( "select wbs_id, wbs_concat_name , wbs_short_name , wbs_name from projwbs where wbs_id = 3986").toString();
              ResultSet rs=null;
              PreparedStatement prepStmt = con.prepareStatement(actionQuery);
              rs = prepStmt.executeQuery();
              int wbsID = 0;
              if (rs == null )
                   System.out.println("rs null");
              else
              while(rs.next())
              wbsID = rs.getInt(1);
              System.out.println("rs not null");
              System.out.print(" " + wbsID);
              System.out.print(" " + rs.getString(2));
              System.out.print(" " + rs.getString(3));
              System.out.print(" " + rs.getString(4));
              rs.close();
              prepStmt.close();
    // Creating Stored Procedure....
    Statement stmt = con.createStatement();
    String procedure = "CREATE OR REPLACE PROCEDURE FirstProc AS BEGIN SELECT PROJ_ID FROM PROJECT; END; ";
    stmt.executeUpdate(procedure);
    System.out.println("Proceudre created or updated successfully!");
    stmt.close();
              catch(Exception e)
                   e.printStackTrace();
    and the complete stack trace!!!
    rs not null
    3986 EN EN ABCfghjkl
    java.sql.SQLException: [ATI][OpenRDA ODBC]Syntax error in SQL statement. syntax error line 1 at or after token <OR>.
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
         at pack1.Try.main(Try.java:134)
    First two lines show the valid output for the select query..which is absolutely correct. But the create procedure statement is throwing above mentioned errors.
    Also one more important thing, I am not been able to view all the columns of table projwbs(its regarding Primavera SDK) through SQL Plus having administrative rights.
    But I can access all the fields using jdbc odbc bridge driver in Java.
    Is there any specific security or access control????
    so that users would able to access specific columns through JDBC only and not through SQL Plus.
    Please help!!!

  • How to pass parameter from 1 stored procedure to another stored procedure inside crystal report

    Hi
    I have several stored procedure in my Crystal Report. I am wondering if it is possible for me to pass a parameter to one of the stored procedure and to use the result of that stored procedure E.g. CustomerCode. To another 2 stored procedure to generate the report dynamically?
    I have 3 stored procedure
    The 1st one is used to gather information and process the calculation
    another 2 stored procedure is used for generate the graph and both of them required to take 2 parameters. The 1st stored procedure will require 1 parameter (E.G. Reference Code) and will return a set of information including the data that could be use on the other 2 stored procedures.
    After I added these 2 stored procedure, it requires me to pass 3 parameters to the report. I would like to know if I could only pass the Reference Code for stored procedure 1 and use it to retrieve the information for the other 2 parameter?
    Thanks in advance
    Chi

    Hi Chi
    To pass parameter from 1 stored procedure to another stored procedure, you will have to create sub report. In your case you will have to create 2 sub reports for 2nd and 3rd stored procedure and link those sub reports with the main report using Reference Code field in order to pass the values.
    After creating the report when you will refresh the report, it will ask 4 parameters, one parameter for main report, one for the first subreport and two for second subreport to fetch the data correctly.
    Regards
    Poonam Thorat.

  • How to call MSSQL stored procedure from oracle database

    MSSQL and Oracle databases are linked thru ODBC link using Oracle HSODBC.
    I can query MSSQL table or view from Oracle Database using standard notation for acessing remote objects schema.object@dblink_name...
    Can anybody give me syntax for calling MSSQL stored procedure thru ODBC database link?
    I tried syntax exec schema.stored_procedure@dblink_name but it doesn't work...i'm getting schema.stored_procedure must be declared error...
    Tnx,in advance!
    Dejan Botica

    Oracle database 10gR2.
    MSSQL2000 database.
    For example query:
    select * from dbo.Tbl_Test@kron@dw_jamnica; works fine...
    ...while for example exec dbo.Test@kron@dw_jamnica;
    reports error:
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'DBO.TEST@KRON@DW_JAMNICA' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Table Tbl_Test and procedure Test exists in MSSQL instance.
    Regards,
    Dejan

  • Java web service to invoke a stored procedure in the database

    Hi
    Does anybody have a example Java web srevice to invoke a stored procedure in the database
    regards
    Edited by: hrishy on May 20, 2011 12:11 AM

    hrishy wrote:
    Thanks i have modified the title so its easy to comprehendWrite the two parts mentioned above and post if you get problems with your code.
    First write code that calls the stored procedure and test that to make sure that it works.
    Then write a simple webservice and test it out to make sure it works. The integration should be trivial after that.

  • Problem passing OUT parameters form based on stored procedure to another form?

    Hello,
    I am unable to pass parameters of type OUT from a form based on a stored procedure to another form.
    However, I am able to pass parameters of the type IN to the other form.
    This is the code that I have under the heading
    On successful submission of a form, execute this PL/SQL block or PL/SQL procedure:
    declare
    v_partno varchar2(100);
    v_partdesc varchar2(200);
    blk varchar2(10):='DEFAULT';
    v_names varchar2(1000);
    v_values varchar2(1000);
    begin
    v_partno:=p_session.get_value_as_varchar2
    (p_block_name=>blk,p_attribute_name=>'A_PART_NO');
    v_partdesc:=p_session.get_value_as_varchar2
    (p_block_name=>blk,p_attribute_name=>'A_PART_DESC');
    v_names := '_moduleid:_show_header:pnumber:pdescription';
    v_values := '1325575336:YES:' || LTRIM(TO_CHAR(v_partno)) || ':' || LTRIM(TO_CHAR(v_partdesc)) ;
    PORTAL.wwa_app_module.link (
    p_arg_names => PORTAL.wwv_standard_util.string_to_table2(v_names),
    p_arg_values => PORTAL.wwv_standard_util.string_to_table2(v_values));
    end
    Info:
    1. Passing PART_NO (IN parameter) and PART_DESC (OUT paramter) to another form.
    2. After hitting the submit button, the second form comes up, but with only the PART_NO(type IN) field completed. The PART_DESC(type OUT) field did not get passed to the second form.
    3. The corresponding fields in the second form are pnumber & pdescription.
    4. FYI - I can see all the OUT parameters correctly, if I don't try to pass control to the second form.
    5. Portal 9.0.2 ( the version that ships with IAS 9.0.2)
    Any help would be greatly appreciated. I have been stuck here for a while now!
    Dev

    Re: Error
    Passing OUT parameter to another form.
    You cannot retrieve the value of the OUT parameter from the session object because after executing your procedure,
    the value passed out using the OUT parameter is not loaded in the session object.
    But you can still achieve what you are trying in the following way.
    Let's assume that your procedure has the following str :-
    procedure proc1 (p_in in varchar2,
    p_out out varchar2)
    is
    begin
    /* your processing statements
    end;
    Say, the name of the field, in the 2nd form, where you need to pass the out parameter value is VALUE_FROM_OUT.
    1> Edit the form on procedure proc1
    2> Select the submit button in the left frame and for the PL/SQL button handler choose Submit action.
    3> In the adjacent textarea, comment out the doSubmit statement and use code given below :-
    declare
    l_p_in varchar2(32767);
    l_p_out varchar2(32767);
    l_url varchar2(2000);
    begin
    l_p_in := p_session.get_value_as_varchar2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_P_IN');
    execute immediate
    'begin <schema>.proc1(:b_in,:b_out); end;'
    using in l_p_in, out l_p_out;
    l_url := 'http://<host>:<port>/pls/<dad>/<portal-schema>.wwa_app_module.link?p_arg_name=_moduleid&p_arg_values=<module_id>&p_arg_names=VALUE_FROM_OUT&p_arg_values='||
    <portal-schema>.wwv_standard_util.url_encode(l_p_out);
    <portal-schema>.wwa_app_module.set_target(l_url,'CALL');
    end;
    NOTE :
    ======
    In the code given above, replace
    <schema> with the schema name that owns the procedure proc1
    <host> with webserver host
    <port> with the port of your webserver
    <dad> with the portal dad
    <portal-schema> with the name of the portal-schema
    <module_id> with the module of the 2nd form i.e. where you need to pass the value of the out variable.
    You will have to grant execute privilege on procedure proc1 to your application schema,
    if the procedure proc1 lies in a schema other than the application schema.
    4> Finish editing the form.

  • Pointbase : How can I create a stored procedure with Pointbase database?

    Hello,
    Excuse me for my english, I'm not anglophone. I try to create a stored procedure.
    This is my file SampleExternalMethods.java :
      import java.sql.*;    //import com.pointbase.jdbc.jdbcInOutDoubleWrapper;          public class SampleExternalMethods    {      // A connection object to allow database callback      static Connection conn = null;      static Statement l_stmt;      static Statement m_stmt;      static CallableStatement m_callStmt = null;      static ResultSet l_rs = null;          public static void main(String[] args)      {        try        {          String url = "jdbc:pointbase:server://localhost/pointbaseDB";          String username = "PBPUBLIC";          String password = "PBPUBLIC";          conn = DriverManager.getConnection(url, username, password);          doCreateProcedure();          doInvokeProcedure();        } catch (SQLException e) {          e.printStackTrace();        } finally {          if (m_stmt != null) {            try {              m_stmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (m_callStmt != null) {            try {              m_callStmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (conn != null) {            try {              conn.close();            } catch (Exception e) {              e.printStackTrace();            }          }        }      }                  public static void getCountry(String Iso_Code)      {        try        {          // Query the database for the country iso code          l_stmt = conn.createStatement();          l_rs = l_stmt.executeQuery( "SELECT * FROM countries"          + " WHERE country_iso_code ='" + Iso_Code + "'");          //Affichage du résultat de la requête          l_rs.next();          System.out.print(l_rs.getString(1) + " - ");          System.out.print(l_rs.getString(2) + " - ");          System.out.println(l_rs.getString(3));          // Close the result set          l_rs.close();        } catch (SQLException e) {          e.printStackTrace();        } finally {          if (l_rs != null) {            try {              l_rs.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (l_stmt != null) {            try {              l_stmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }        }      }            public static void doCreateProcedure() throws SQLException {        // SQL statement to create a stored procedure        String SQL_CREATE_PROC = "CREATE PROCEDURE getCountry(IN P1 VARCHAR(30))"        + " LANGUAGE JAVA"        + " SPECIFIC getCountry"        + " NO SQL"        + " EXTERNAL NAME \"SampleExternalMethods::getCountry\""        + " PARAMETER STYLE SQL";        // Create a SQL statement        m_stmt = conn.createStatement();        // Execute the SQL        m_stmt.executeUpdate(SQL_CREATE_PROC);        // Close the statement        //m_stmt.close();      }          public static void doInvokeProcedure() throws SQLException {        // Create SQL to invoke stored procedures        String SQL_USE_PROC = "{ call getCountry(?) }";        // Create a callable statement with three binding parameters        m_callStmt = conn.prepareCall(SQL_USE_PROC);        m_callStmt.setString(1, "CA");        m_callStmt.executeQuery();        // Close the callable statement        //m_callStmt.close();      }    } 
    Afterwards, I have read this note in a Pointbase document:
    To invoke the dateConvert external Java method from a stored function, you must use the
    CREATE FUNCTION statement. The dateConvert external Java method is called from the
    class, SampleExternalMethods.
    In order for the database to access this external Java method, the class SampleExternalMethods
    must be included in the database CLASSPATH. For PointBase Embedded - Server Option, it
    must be in the Server CLASSPATH, but not in the Client CLASSPATH.
    If PointBase Server is run with the Java Security Manager, in the java policy file grant
    ’com.pointbase.sp.spPermission’ to the class that implements the external Java method.
    An "spPermission" consists of a class name with no action. The class name is a name of a class
    that could be used in creating a Stored Procedure in PointBase. The naming convention follows
    the hierarchical property naming convention and that is supported by
    "java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded
    by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
    contain any white spaces.
    I'm not sure, but I suppose that I must include the class SampleExternalMethods in a .jar file.
    The database CLASSPATH could be : C:\Sun\AppServer\pointbase\lib\
    These my files in this database CLASSPATH:
    pbclient.jar
    pbembedded.jar
    pbtools.jar
    pbupgrade.jar
    I have tryed to include the class SampleExternalMethods in pbclient.jar and pbembedded.jar with this command:
    jar -uf pbembedded.jar SampleExternalMethods
    Afterwards I do that,
    1) Start Pointbase
    2) Configuration of classpath
    set classpath=C:\Sun\AppServer\pointbase\lib\pbclient.jar
    set classpath=%classpath%;D:\J2EE\Ch07Code\Ch07_06
    I precise that my file SampleExternalMethods is into D:\J2EE\Ch07Code\Ch07_06\Ch07.
    Then, I run the program:
    D:\J2EE\Ch07Code\Ch07_06>java -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver Ch07.SampleExternalMethods
    But I have an error message:
    Exception in thread "main" java.lang.NoClassDefFoundError: Ch07.SampleExternalMethods (wrong name: SampleExternalMethods)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.DefineClass(ClassLoader.java:539)
    The problem, I suppose, comes from that the class SampleExternalMethods
    must be included in the database CLASSPATH, but there is a pbserver.jar with pointbase normally, but I didn't find it. That's why I use pbembedded.jar or pbclient.jar in order to include the class SampleExternalMethods. May be I must start from C:\Sun\AppServer\pointbase\lib\ instead of D:\J2EE\Ch07Code\Ch07_06\Ch07?
    Please, can somebody helps me?
    Thank you in advance.
    cagou!

    jschell wrote:
    And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    >And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    >
    And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    Thank you for your response, I have done two classes:
    SampleExternalMethods.java:
    package Ch07;
    import java.sql.*;*
    *public class SampleExternalMethods*
    *public static void getCountry(String Iso_Code)*
    *// A connection object to allow database callback*
    *Connection l_conn = null;*
    *Statement l_stmt = null;*
    *ResultSet l_rs = null;*
    *try*
    *String url = "jdbc:pointbase:server://localhost/pointbaseDB";*
    *String username = "PBPUBLIC";*
    *String password = "PBPUBLIC";*
    *l_conn = DriverManager.getConnection(url, username, password);*
    *// Query the database for the country iso code*
    *l_stmt = l_conn.createStatement();*
    *l_rs = l_stmt.executeQuery( "SELECT* FROM PBPUBLIC.COUNTRIES"
    +" WHERE country_iso_code ='"+ Iso_Code +"'");+
    +//Affichage du r&eacute;sultat de la requ&ecirc;te+
    +l_rs.next();+
    +System.out.print(l_rs.getString(1)+ " - ");
    System.out.print(l_rs.getString(2) +" - ");+
    +System.out.println(l_rs.getString(3));+
    +// Close the result set+
    +l_rs.close();+
    +} catch (SQLException e) {+
    +e.printStackTrace();+
    +} finally {+
    +if (l_rs != null) {+
    +try {+
    +l_rs.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (l_stmt != null) {+
    +try {+
    +l_stmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (l_conn != null) {+
    +try {+
    +l_conn.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +}+
    +}+
    +}+
    CreateMethods.java:
    +package Ch07;+
    +import java.sql.*;+
    +public class CreateMethods+
    +{+
    +// A connection object to allow database callback+
    +static Connection m_conn = null;+
    +static Statement m_stmt;+
    +static CallableStatement m_callStmt = null;+
    +public static void main(String[] args)+
    +{+
    +try+
    +{+
    +String url = "jdbc:pointbase:server://localhost/pointbaseDB";+
    +String username = "PBPUBLIC";+
    +String password = "PBPUBLIC";+
    +m_conn = DriverManager.getConnection(url, username, password);+
    +doCreateProcedure();+
    +doInvokeProcedure();+
    +} catch (SQLException e) {+
    +e.printStackTrace();+
    +} finally {+
    +if (m_stmt != null) {+
    +try {+
    +m_stmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (m_callStmt != null) {+
    +try {+
    +m_callStmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (m_conn != null) {+
    +try {+
    +m_conn.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +}+
    +}+
    +public static void doCreateProcedure() throws SQLException {+
    +// SQL statement to create a stored procedure+
    +String SQL_CREATE_PROC = "CREATE PROCEDURE PBPUBLIC.getCountry(IN P1 VARCHAR(30))"+
    " LANGUAGE JAVA"
    +" SPECIFIC getCountry"+
    " NO SQL"
    +" EXTERNAL NAME \"SampleExternalMethods::getCountry\""+
    " PARAMETER STYLE SQL";
    // Create a SQL statement
    m_stmt = m_conn.createStatement();
    // Execute the SQL
    m_stmt.executeUpdate(SQL_CREATE_PROC);
    // Close the statement
    //m_stmt.close();
    public static void doInvokeProcedure() throws SQLException {
    // Create SQL to invoke stored procedures
    String SQL_USE_PROC = "{ call getCountry(?) }";
    // Create a callable statement with three binding parameters
    m_callStmt = m_conn.prepareCall(SQL_USE_PROC);
    m_callStmt.setString(2, "CA");
    m_callStmt.executeQuery();
    // Close the callable statement
    //m_callStmt.close();
    }But I have the same error message that previously.
    I have read this note and I suppose that the problem is linked:
    If PointBase Server is run with the Java Security Manager, in the java policy file grant
    *’com.pointbase.sp.spPermission’ to the class that implements the external Java method.*
    An "spPermission" consists of a class name with no action. The class name is a name of a class
    that could be used in creating a Stored Procedure in PointBase. The naming convention follows
    the hierarchical property naming convention and that is supported by
    *"java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded*
    by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
    contain any white spaces.
    Can you explain me what I must to do in order to solve this problem of spPermission.
    Thanks.

  • DB adapter calling stored procedure and change database schema

    Hello,
    when I create DB adapter which call stored procedure I find that is reference to DB schema in JCA file. Other DB adapter operation (select, insert, delete) store only connection-factory location.
    What happend when I move procedure to another DB schema or rename DB schema?
    It is only about change SchemaName in JCA file?
    Thank you.

    It sounds excelent.
    I try it. Change JCA file and redeploy SCA of service.
    Next I change user in data source (password is the same for both schemas). Save and activate changes. Update deployment of DBAdapter.
    Select operation on service works but return data from old schema.
    Call stored procedure fail with exception:
    oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'delete' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the NEW_SCHEMA.PKG_UTILS.SERVICE_REMOVE API. An error occurred while preparing and executing the NEW_SCHEMA.PKG_UTILS.SERVICE_REMOVE API. Cause: java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'NEW_SCHEMA.PKG_UTILS' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored Check to ensure that the API is defined in the database and that the parameters match the signature of the API. This exception is considered not retriable, likely due to a modelling mistake. To classify it as retriable instead add property nonRetriableErrorCodes with value "-6550" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers. ". The invoked JCA adapter raised a resource exception.

  • Query in Stored Procedure accessing another schema

    Hi - this is going to sound kind of strange and even i can't come up with an explanation. My JDK 1.1.7 applet uses a type 4 JDBC thin driver (i think v 8.04.06) to access an Oracle 7.3.4 database. We also have a link with full grants and synonymns to another Oracle schema in an Oracle 8 database. Has never been a problem - we can access anything we need to through queries or stored procedures from either of these databases.
    So, i have a new stored procedure that needs to be called through JDBC that queries a table in the Oracle 8 database. For some reason, whenever i execute this stored procedure from java it hangs on this query and the instance needs to be restarted. If i execute that same stored procedure from SQL Plus, it runs fine.
    I tried a little test. I put a straight query in my java code that goes directly to that table (no stored procedure involved). It runs great through java!
    is this weird or what? my dbas have checked out all privelages and it seems that i have access to everything i could possibly need.
    If anyone has any suggestions i would love to hear them.
    thanks for your help...
    Lori - [email protected]
    null

    You can only access an object in another user's schema if you either:
    (a) Specify the 'other' schema name explicitly: SCHEMA.OBJECT
    (b) A synonymn has been created to access the object: CREATE SYNONYM OBJECT FOR SCHEMA.OBJECT.
    The user requiring the synonym should create it, or the user owning the object can create a PUBLIC synonym, if they have the authority.
    To check my hypothesis, try typing 'DESCRIBE procedure_name' from SQL*Plus as both users.

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

Maybe you are looking for

  • Doubt in data transfer

    can anybody tell wat type of interface or which method  can be used to move datas or table from flat file structure the requriement is first we have to generate a flatfile structure from sap r/3 and we have to trasfer the datas to one particular serv

  • Problem in compiling the sample applet

    hello: im installed jdk 1.2.2 now i wanna folow the instruction written in the PDF document.i did everything as it is but when i arrived to the step "compiling the sample applet" i issue the command " javac -g src/com/sun/javacard/samples/helloWorld/

  • Error in displaying hierachry report with TableView and Tableiterator

    Hello, I tried to create a BSP as shown in this tutorial: /people/vijaybabu.dudla/blog/2008/08/04/display-hierarchy-report-in-bsp-using-tableview-and-tableview-iterator When starting the BSP I get an error that a field symbol is not assigned in the m

  • MS VC++ runtime error - running nimxs.exe suring computer boot

    Somehow my labtop starts to fail to run MAX (nimxs.exe) during start up. Message is "Micrsoft Visual C++ runtime error. This application has requested the runtime to terminate it in an unusual way. Please contact the application's support team for mo

  • IMac - Mac Book Memory

    Will the 1GB PC2-5300 memory module that I pulled out of my iMac work on a Mac Book?