Java Bea CallableStatement

What i use:
Oracle 8.1.7.0.0
jsp
i have a Stored procedure that has an IN OUT number
in the jsp i do the following
... //declare variables yada yada
cs = conn.prepareCall("{call MARKET_COPY(?)}");
cs.setInt(1, 12); cs.registerOutParameter(1, java.sql.Types.NUMERIC); cs.executeUpdate();
out.println("Should See Number:" +
cs.getInt(1));
//...Close stuff, catch, finally
heres the problem
It works, sort of. it sends in the data, and then retrieves the output. But it throws a "java.lang.NullPointerException". i believe it is happening at the "registerOutParameter" method call, but do not know why, mainly because its doing what its supposed to.
as for the "conn.prepareCall", i have tried useing "{? = proc_name(?)});" but this does not work, i get the error
"java.sql.SQLException: ORA-01008: not all variables bound"
i know that i could just swallow the error, but that could lead to secureity problems possibly, and that is not an option. if you can help, or point me to some documentation that would be great.
if you need more info(code, description), just ask.
-Brian

never mind, i must suffer from retardation or something, i have a null rs and i close it. . . .

Similar Messages

  • A Professional Java BEA Aqualogic Expert looking for contract position

    A Professional Java BEA Aqualogic Expert looking for contract position in Northern/Central NJ or NYC.
    For more details, please feel free to contact me:
    Dmitry Bryazgin
    [email protected]
    Cell: 212 365 4747
    Edited by Bryazgin at 04/02/2008 7:58 AM

    Don�t give up!
    I know it is not the forum for this but I couldn�t resist dropping you this message. I lost my job since February. I have tried many things and I am still trying.
    Keep working every day that is the Key.
    Best luck.
    chuck

  • The problem about java.sql.CallableStatement

    we need call oracle store procedure to get a record set.
    the code below is the oracle's pl/sql program for test
    package test2 as
    type sample_record is record(id char(4),
    name varchar2(10),
    addr varchar2(30));
    type sample_cursor is ref cursor return sample_record;
    function get_resultset return sample_cursor;
    end;
    package body test2 as
    function get_resultset return sample_cursor is
    p_cursor sample_cursor;
    begin
    open p_cursor for select 'aaaa' id,'John' name,'guangzhou' addr from dual;
    return p_cursor;
    end get_resultset;
    end;
    and ,in java,how to use java.sql.CallableStatement to
    run the store procedure to get the cursor,a sql type define in our oracle programme

    see the code below,
    public static sun.jdbc.rowset.WebRowSet testmethod(){
         Connection conn = null ;
              CallableStatement cstmt = null ;
              String str = null ;
              ResultSet result = null ;
              str = "{?=call test2.get_resultset()}" ;                    
              try
                   conn = DbPool.getConnection() ;
                   cstmt = conn.prepareCall(str) ;
                   cstmt.registerOutParameter(1, OracleTypes.CURSOR);
                   cstmt.execute();
                   result = (java.sql.ResultSet)cstmt.getObject(1) ;                                             
                   sun.jdbc.rowset.WebRowSet wrs = new sun.jdbc.rowset.WebRowSet() ;
              wrs.populate(result) ;//in this statement,it will throw a NullPointerException
                   return wrs;
              catch (Exception e)
                   CommLog.writeLog("pr", "PrLogic test: " + e.toString()) ;
                   return null ;
              }finally
                   try
                        result.close() ;
                   catch (Exception e3)
                   try
                        cstmt.close() ;
                   catch (Exception e1)
                   try
                        conn.close() ;
                   catch (Exception e2)
         }

  • Column Not found error while trying to access database through JSP+Java Bea

    I am trying to access MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the database is incorporated in the bean.The JSP only calls the particular method of the bean .
    Code for Java Bean:
    package ActiveViewer;
    import java.sql.*;
    import java.util.*;
    public class CompanyBean
    Connection con;
    ResultSet rs=null;
    Statement st;
    public CompanyBean(){}
    public void connect()
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Here4");
    con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
    System.out.println("Here1");
    catch (ClassNotFoundException e)
    System.out.println("Could not locate driver.");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An unknown Exception has occured :: "+e);
    e.printStackTrace();
    public void disconnect()
    try
    if (con!=null)
    con.close();
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    public ResultSet select(String username)
    if(con!=null)
    try
    st=con.createStatement();
    rs=st.executeQuery("select * from company where username='" + username + "'");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An Exception has occured while retrieving :: "+e);
    e.printStackTrace();
    else
    System.out.println("Connection to database was lost.");
    return rs;
    The code for JSP that uses the above bean is:
    <%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
    <jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
    <html>
    <body>
    <% String username=request.getParameter("username");
    String password=request.getParameter("password");
    System.out.println("username:"+username);
    System.out.println("password:"+password);
    conn.connect();
    ResultSet rs=conn.select(username);
    System.out.println("Below select ");
    while (rs.next())
    String dbusername=rs.getString("username");
    String dbpassword=rs.getString("password");
    if(dbusername.equals(username) && dbpassword.equals (password))
    { %> out.println("OK");
    <% }
    else { %>Invalid Username and / or Password.
    <br>Clickhere to go back to Login Page.
    <% }
    } %>
    </body>
    </html>
    I get the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Column not found
    though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
    Here4 (from connect method above)
    Here 1 (from connect method above)
    Below Select (from jsp)
    This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
    All other things like creating package for bean in WEB-INF/classes,incorporating the packakage are done.
    Can someone please help me with their precious advice?

    Hi, I too have a problem with an SQL exception, the message is Column not found.
    I'm using the sun jdbc odbc driver with access.
    the first few lines of the stack trace are
    sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1852)
    sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
    net.homeip.sdaniels.MemberBean.ejbFindByUnamePwd(MemberBean.java:127)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    I am of course sure that the column does infact exist. I can insert into the column no problems. the sql looks like this:
    SELECT * FROM Members WHERE uName ='Stewart' AND encPwd='�F2C�3����h�1Y�'
    Can any one tell me if there is a common cause to this problem?
    Thanks

  • Problem preparing CallableStatement with Weblogic Sybase driver

    I recently switched to using Weblogic's Sybase driver and immediately ran into a problem with some existing JDBC code that ran fine with Sybase's driver. Here is an excerpt of the code:
    String sql = "{call my_sybase_procedure ?,?,?,?,?,?,?,?,?}";
    Connection c = null;
    CallableStatement stmt = null;
    try {     
         stmt = c.prepareCall(sql);
    On the prepareCall method call the following Exception is thrown:
    java.sql.SQLException: [BEA][Sybase JDBC Driver][Sybase]Incorrect syntax near '{'.
    As I said this code runs fine using the Sybase driver com.sybase.jdbc2.jdbc.SybDriver but when I switched to weblogic.jdbc.sybase.SybaseDriver I ran into the problem. I'm using Weblogic Server 8.1 SP4 and the Sybase version is 12.5.
    For now I will revert to using the Sybase driver but if anyone has any insight into this problem I would appreciate the help. Thanks.

    slambert wrote:
    I was looking at the example syntax provided here:
    [url http://java.sun.com/j2se/1.4.2/docs/api/java/sql/CallableStatement.html]http://java.sun.com/j2se/1.4.2/docs/api/java/sql/CallableStatement.html
    It shows square brackets which I interpret as meaning that the parameters are optional. It would have been clearer to me if parentheses were included inside the square brackets.
    Hi. Here's what I get from my JavaSoft doc contacts:
    "For Java SE 6/JDBC 4.0 we corrected it to be:
    {?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
    {call <procedure-name>[(<arg1>,<arg2>, ...)]}
    { call foo} is valid if there are no arguments but you must have
    {call foo(?)|}
    if parameters are passed.
    The javadocs finally now match 13.4.4 of the spec."
    Joe

  • Unable to execute an update statement using CallableStatement

    Hi there,
    I'm trying to run an update statement from JUnit using java.sql.CallableStatement and oracle.jbo.server.DBTransaction.
            String updateSql =
                "update footable set barcol=TO_DATE('12-SEP-09','dd-MM-yy') where bazcol = 505";
            try {
                statement =
                        applnModule.getDBTransaction().createCallableStatement(updateSql,
                                                                               2);
                int executeUpdate = statement.executeUpdate();
                AppsLogger.write(this,
                                 "# records UPDATED ------------------>" + executeUpdate,
                                 AppsLogger.SEVERE);
            } catch (SQLException s) {
                s.printStackTrace();
                Assert.fail("Encountered SQL Exception: " + s);
            } finally {
                try {
                    if (statement != null)
                        statement.close();
                } catch (SQLException s) {
            }Below is the exception I get when I run the above code. There is no problem with the SQL - it works fine from SQLDeveloper.
    java.lang.AssertionError: Encountered SQL Exception: java.sql.SQLDataException: ORA-01858: a non-numeric character was found where a numeric was expected
         org.junit.Assert.fail(Assert.java:91)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.junit.internal.runners.TestMethod.invoke(TestMethod.java:66)
         org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105)
         org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
         org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
         org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
         org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
         oracle.apps.common.applicationsTestFramework.junit.internal.AtfJUnit4JTestCaseClassRunner.invokeTestMethod(AtfJUnit4JTestCaseClassRunner.java:362)
         oracle.apps.common.applicationsTestFramework.junit.internal.AtfJUnit4JTestCaseClassRunner.runMethods(AtfJUnit4JTestCaseClassRunner.java:272)
         oracle.apps.common.applicationsTestFramework.junit.internal.AtfJUnit4JTestCaseClassRunner$1.run(AtfJUnit4JTestCaseClassRunner.java:265)
         org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
         org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
         oracle.apps.common.applicationsTestFramework.junit.internal.AtfJUnit4JTestCaseClassRunner.run(AtfJUnit4JTestCaseClassRunner.java:262)Edited by: 911023 on Oct 2, 2012 11:28 AM
    Edited by: 911023 on Oct 2, 2012 11:30 AM

    Using case statement.
    UPDATE gor_gold_post
       SET hoov_flag = CASE WHEN TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) < 304
                                   OR
                                   (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) IS NULL
                                AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2)
                           THEN 1
                           ELSE 99
                         END,
           b49n      = CASE WHEN TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) < 121.6
                             OR
                             (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) IS NULL
                                AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2)
                           THEN 1
                           ELSE 99
                         END
    WHERE tariff_code IN (169, 135, 136);Note: Code not tested.

  • Explicit cast needed to convert java.* to to oracle.*

    Hello,
    I am trying to compile and run the following JSP but keep getting the "Incompatible type for = Explicit cast needed ..." error. The JSP and oracle procedure code are as follows:
    <%@ page language="java" import="java.sql.*" %>
    <%@ page import="oracle.jdbc.driver.*" %>
    <HTML>
    <HEAD>
    <TITLE>
    SimpleQuery JSP
    </TITLE>
    </HEAD>
    <BODY BGCOLOR=EOFFFO>
    <TABLE BORDER=1 BGCOLOR="C0C0C0">
    <TH BGCOLOR="white"> <I>Node ID</I> </TH>
    <%
         Connection con = null;
    OracleCallableStatement cstmt= null;
         ResultSet rs = null;
    try {
              String SYSTEM_DB_DRIVER =
    "oracle.jdbc.driver.OracleDriver";
    String SYSTEM_DB_URL =
    "jdbc:oracle:thin:@myserver.com:1521:";
    String SYSTEM_DB_FILE = "CONN_STRING";
    String SYSTEM_DB_USER = "UNAME";
    String SYSTEM_DB_PASSWORD = "PASSWD";
              Class.forName(SYSTEM_DB_DRIVER);
    con = DriverManager.getConnection(SYSTEM_DB_URL +
    SYSTEM_DB_FILE, SYSTEM_DB_USER, SYSTEM_DB_PASSWORD);
              cstmt = con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");
              cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    <<I think I have to pass the p_product_id_in here but not sure how>>
              cstmt.execute();
              rs = ((OracleCallableStatement)cstmt).getCursor(1);
              while(rs.next())
              {%>
         <TR>
         <TD ALIGN=CENTER> <%= rs.getString(1) %> </TD>
         <TD ALIGN=CENTER> <%= rs.getInt(2) %> </TD>
    </TR>
              <%}
                   rs.close();
    cstmt.close();
    con.close();
    catch(Exception e)
    %>
    </TABLE>
    </BODY>
    </HTML>
    The Oracle PL/SQL package.procedure it is calling is:
         PROCEDURE open_rules_dtl (
              prc_rules_dtl_out          OUT     rc_fetch_rule_dtl,
              p_product_id_in          IN          NUMBER )
         IS
              vrc_rules_dtl               rc_fetch_rule_dtl;
         BEGIN
              OPEN vrc_rules_dtl FOR
                   SELECT
                        r.rule_id,
                        r.rule_name,
                        r.rule_objective,
                        r.rule_description,
                        r.clearance_requirement,
                        r.rule_type
                   FROM
                        eaicl_rule r
                   WHERE
                        r.is_old = 'N' AND
                        r.product_id = CHR( p_product_id_in )
                   ORDER BY
                        r.rule_name
              prc_rules_dtl_out := vrc_rules_dtl;
    END open_rules_dtl;
    I keep getting the following error on the webserver:
    [05/Dec/2001:16:56:02] info ( 632): JSP: JSP1x compiler threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSPC:\iPlanet\Server4\https-wacc\config\..\ClassCache\_jsps\_ss_test5_jsp.java:84: Incompatible type for =. Explicit cast needed to convert java.sql.CallableStatement to oracle.jdbc.driver.OracleCallableStatement.
              cstmt = con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");
              ^
    I'm not sure how to fix it. I also need to pass the p_product_id parameter to the procedure.
    Hope someone can point me in the right direction. Thanks.

    Here's how you do an explicit cast:cstmt = (OracleCallableStatement)con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");

  • Passing String Array from Java to PL/SQL

    Hi,
    We are having couple of packages which have been written in PL/SQL . I would like to know how i can send arrays as input parameters from Java to any stored proc in Oracle. I am having Oracle 8i as the DB and am using Websphere RSA for deployment purposes.
    please find below Java , PL/SQL code and exception
    PL/SQL Code :
    PACKAGE PKG_SURCHARGE
    IS
    TYPE commodity_key IS TABLE OF VARCHAR2(500) INDEX BY BINARY_INTEGER;
    PROCEDURE RETRIEVE_CHARGES
    in_Commodity_tab IN commodity_key,
    IS
    BEGIN
    dbms_output.put_line('in_Commodity_tab(' || '0' || ') : ' || in_Commodity_tab(0) );
    Java Code :
    CallableStatement cstmt=null;
    Connection conn=null;
    try{
    conn=getConnection();
    System.out.println("++++++connected");
    String sqlStr = "{call Pkg_Surcharge.RETRIEVE_CHARGES(?) }";
    cstmt = conn.prepareCall(sqlStr );
    //1.
    String[] javaArray={"20081117","20081117"};
    ArrayDescriptor dateDescripter = ArrayDescriptor.createDescriptor( "commodity_key", conn );
    oracle.sql.ARRAY dateArray = new oracle.sql.ARRAY(dateDescripter, conn, javaArray);
    System.out.println("++++++registered-1");
    Catch (Exception e){
    e.printStackTrace();
    Exception Occured:
    java.sql.SQLException: Invalid Pattern Name <Schema Name>.commodity_key
    Appreciate your help in this regard
    Thanks
    Srini
    Edited by: [email protected] on Nov 25, 2008 4:55 AM

    Avi is correct. You must create a varray or nested table instead of using a PL/SQL index-by table.
    SQL> create type commodity_key as varray(#) of varchar2(500);
    or
    SQL> create type commodity_key as table of varchar2(500);
    Use the varray if you know the number of items in the array. Otherwise, use the nested table.

  • !!! I need to get the return value from a PL/SQL in Java.. How??? !!!

    Hi
    -- I have a PL/SQL in which it return an array value and I need to get the value using Java.... any idea how?
    thanks

    Check out CallableStatement:
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/CallableStatement.html

  • To call db2 stored procedure having parameters in java application

    Hi,
    I've created db2 stored procedure which is running perfectly on db2 server after giving a CALL to it. But when I tried to call this same stored procedure in java application, its reflecting with following error......
    com.ibm.db2.jcc.b.SqlException: [jcc][10100][10910][3.50.152] java.sql.CallableStatement.executeQuery() was called but no result set was returned.
    Use java.sql.CallableStatement.executeUpdate() for non-queries. ERRORCODE=-4476, SQLSTATE=null
    at com.ibm.db2.jcc.b.wc.a(wc.java:55)
    at com.ibm.db2.jcc.b.wc.a(wc.java:102)
    at com.ibm.db2.jcc.b.tk.b(tk.java:575)
    at com.ibm.db2.jcc.b.vk.yb(vk.java:136)
    at com.ibm.db2.jcc.b.vk.executeQuery(vk.java:114)
    at SPApplication.main(SPApplication.java:31)
    Here is the code.......
    import java.sql.*; public class SPApplication { public static Connection con; public static CallableStatement proc_stmt; public static ResultSet rs; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { Class.forName("DB2 DRIVER CLASS"); System.out.println("Class loaded....."); con = DriverManager.getConnection("jdbc:db2://localhost:PORTNO/" +                                   " DatabaseName", "username", "password"); System.out.println("Connection established....."); proc_stmt = con.prepareCall("call procedure_name(?)"); //IN Parameter proc_stmt.setInt(1, 5); System.out.println("Called procedure....."); rs = proc_stmt.executeQuery(); /******** THIS IS LINE NO. 31 *********/ while (rs.next()) {                              // Fetching rows one by one over here } proc_stmt.close(); rs.close(); con.close(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException sqle) { sqle.printStackTrace(); } finally { /* try { proc_stmt.close(); rs.close(); con.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } */ } } }
    Please correct me, if I am wrong at any point in my application..
    I would really appreciate for resolving my problem.
    Thanks,
    Manasi N.

    Hi jschell ,
    Firstly, I tried out with execute() and getMoreResults() to check if the statement is returning result set. - Its returning "null" only.
    Secondly, I tried with following one by one :
    1. Find a new jdbc driver
    2. Write a different stored procedure.I am using DB2 Express edition - DB2 v9.7.0.0
    I have the required jar files - i)db2jcc.jar ii) db2jcc_license_cu.jar
    From these I found the available jdbc drivers as -
    i) com.ibm.db2.jcc.DB2Driver
    ii) COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver
    iii) com.ibm.db2.jcc.uw.DB2StoredProcDriver
    I tried out my code by using each of these drivers, but still returning result set as null.
    Moreover, I changed my stored procedure which has cursor returning result set. In this case also, result set is null.
    Code snippet for this SP is -
    30             Class.forName("com.ibm.db2.jcc.uw.DB2StoredProcDriver");
    31             System.out.println("Class loaded....");
    32             con = DriverManager.getConnection
    33                 ("jdbc:db2://localhost:portno/dbName", "user", "password");
    34             System.out.println("Connection established....");
    35
    36             proc_stmt = con.prepareCall("call javaSP()");
    37            
    38             System.out.println("Called stored procedure....");
    39            
    40             proc_stmt.execute();
    41             //proc_stmt.executeUpdate();
    42             //rs = proc_stmt.getResultSet();
    43
    44             System.out.println("Query executed....");
    45            
    46             if ((proc_stmt.getMoreResults() == false) &&
    47                     (proc_stmt.getUpdateCount() == -1)) {
    48                 System.out.println("No more result sets");
    49             }o/p is (for every mentioned above jdbc driver) :-
    Class loaded....
    Connection established....
    Called stored procedure....
    Query executed....
    No more result sets..
    The o/p is always "No more result sets"
    What else can be tried out to retrieve the result set from stored procedure from Java application? And the most important, these same stored procedures are returning result sets on db2 server after calling them.
    Thank you,
    Manasi.N
    Edited by: Manasi.N on Apr 14, 2010 12:27 AM
    Edited by: Manasi.N on Apr 14, 2010 12:28 AM

  • Java.lang.VerifyError - Incompatible object argument for function call

    Hi all,
    I'm developing a JSP application (powered by Tomcat 4.0.1 in JDK 1.3, in Eclipse 3.3). Among other stuff I have 3 classes interacting with an Oracle database, covering 3 use cases - renaming, adding and deleting an database object. The renaming class simply updates the database with a String variable it receives from the request object, whereas the other two classes perform some calculations with the request data and update the database accordingly.
    When the adding or deleting classes are executed, by performing the appropriate actions through the web application, Tomcat throws the following:
    java.lang.VerifyError: (class: action/GliederungNewAction, method: insertNewNode signature: (Loracle/jdbc/driver/OracleConnection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V) Incompatible object argument for function call
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:120)
         at action.ActionMapping.perform(ActionMapping.java:53)
         at ControllerServlet.doResponse(ControllerServlet.java:92)
         at ControllerServlet.doPost(ControllerServlet.java:50)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    ...The renaming works fine though. I have checked mailing lists and forums as well as contacted the company's java support but everything I have tried out so far, from exchanging the xerces.jar files found in JDOM and Tomcat to rebuidling the project didn't help.
    I just can't explain to myself why this error occurs and I don't see how some additional Java code in the other 2 classes could cause it?
    I realize that the Tomcat and JDK versions I'm using are totally out of date, but that's company's current standard and I can't really change that.
    Here's the source code. I moved parts of the business logic from Java to Oracle recently but I left the SQL statements that the Oracle stored procedures are executing if it helps someone.
    package action;
    import java.sql.CallableStatement;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.StringTokenizer;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import oracle.jdbc.driver.OracleConnection;
    * This class enables the creation and insertion of a new catalogue node. A new node
    * is always inserted as the last child of the selected parent node.
    public class GliederungNewAction implements Action {
         public String perform(ActionMapping mapping, HttpServletRequest request,
                   HttpServletResponse response) {
              // fetch the necessary parameters from the JSP site
              // the parent attribute is the selected attribute!
              String parent_attribute = request.getParameter("attr");
              String catalogue = request.getParameter("catalogue");
              int parent_sequenceNr = Integer.parseInt(request.getParameter("sort_sequence"));
              // connect to database    
              HttpSession session = request.getSession();   
              db.SessionConnection sessConn = (db.SessionConnection) session.getAttribute("connection");
              if (sessConn != null) {
                   try {
                        sessConn.setAutoCommit(false);
                        OracleConnection connection = (OracleConnection)sessConn.getConnection();
                        int lastPosition = getLastNodePosition( getLastChildAttribute(connection, catalogue, parent_attribute) );
                        String newNodeAttribute = createNewNodeAttribute(parent_attribute, lastPosition);
                        // calculate the sequence number
                        int precedingSequenceNumber = getPrecedingSequenceNumber(connection, catalogue, parent_attribute);
                        if ( precedingSequenceNumber == -1 ) {
                             precedingSequenceNumber = parent_sequenceNr;
                        int sortSequence = precedingSequenceNumber + 1;
                        setSequenceNumbers(connection, catalogue, sortSequence);
                        // insert the new node into DB
                        insertNewNode(connection, catalogue, newNodeAttribute, parent_attribute, "Neuer Punkt", sortSequence);
                        connection.commit();
                   } catch(SQLException ex) {
                        ex.printStackTrace();
              return mapping.getForward();
          * Creates, fills and executes a prepared statement to insert a new entry into the specified table, representing
          * a new node in the catalogue.
         private void insertNewNode(OracleConnection connection, String catalogue, String attribute, String parent_attribute, String description, int sortSequence) {
              try {
                   String callAddNode = "{ call fasi_lob.pack_gliederung.addNode(:1, :2, :3, :4, :5) }";
                   CallableStatement cst;
                   cst = connection.prepareCall(callAddNode);
                   cst.setString(1, catalogue);
                   cst.setString(2, attribute);
                   cst.setString(3, parent_attribute);
                   cst.setString(4, description);
                   cst.setInt(5, sortSequence);
                   cst.execute();
                   cst.close();
              } catch (SQLException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
    //          String insertNewNode = "INSERT INTO vstd_media_cat_attributes " +
    //                    "(catalogue, attribute, parent_attr, description, sort_sequence) VALUES(:1, :2, :3, :4, :5)";
    //          PreparedStatement insertStmt;
    //          try {
    //               insertStmt = connection.prepareStatement(insertNewNode);
    //               insertStmt.setString(1, catalogue);
    //               insertStmt.setString(2, attribute);
    //               insertStmt.setString(3, parent_attribute);
    //               insertStmt.setString(4, description);
    //               insertStmt.setInt(5, sortSequence);
    //               insertStmt.execute();
    //               insertStmt.close();
    //          } catch (SQLException e) {
    //               e.printStackTrace();
          * This method returns the attribute value of the last child of the parent under which
          * we want to insert a new node. The result set is sorted in descending order and only the
          * first result (that is, the last child under this parent) is fetched.
          * If the parent node has no children, "parent_attr.0" is returned. 
          * @param connection
          * @param catalogue
          * @param parent_attribute
          * @return attribute of the last child under this parent, or "parent_attr.0" if parent has no children
         private String getLastChildAttribute(OracleConnection connection, String catalogue, String parent_attribute) {
              String queryLastChild = "SELECT attribute FROM vstd_media_cat_attributes " +
                                            "WHERE catalogue=:1 AND parent_attr=:2 ORDER BY sort_sequence DESC";
              String lastChildAttribute;
              PreparedStatement ps;
              try {
                   ps = connection.prepareStatement(queryLastChild);
                   ps.setString(1, catalogue);
                   ps.setString(2, parent_attribute);
                   ResultSet rs = ps.executeQuery();
                   /* If a result is returned, the selected parent already has children.
                    * If not set the lastChildAttribute to parent_attr.0
                   if (rs.next()) {
                        lastChildAttribute = rs.getString("attribute");
                   } else {
                        lastChildAttribute = parent_attribute.concat(".0");
                   rs.close();
                   return lastChildAttribute;
              } catch (SQLException e) {
                   e.printStackTrace();
                   return null;
          * This helper method determines the position of the last node in the attribute.
          * i.e for 3.5.2 it returns 2, for 2.1 it returns 1 etc.
          * @param attribute
          * @return position of last node in this attribute
         private int getLastNodePosition(String attribute) {
              StringTokenizer tokenizer = new StringTokenizer(attribute, ".");
              String lastNodePosition = "0";
              while( tokenizer.hasMoreTokens() ) {
                   lastNodePosition = tokenizer.nextToken();
              return Integer.parseInt(lastNodePosition);
          * This method calculates the attribute of a node being inserted
          * by incrementing the last child position by 1 and attaching the
          * incremented position to the parent.
          * @param parent_attr
          * @param lastPosition
          * @return attribute of the new node
         private String createNewNodeAttribute(String parent_attr, int lastPosition) {
              String newPosition = new Integer(lastPosition + 1).toString();
              return parent_attr.concat("." + newPosition);
          * This method checks if the required sequence number for a new node is already in use and
          * handles the sequence numbers accordingly.
          * If the sequence number for a new node is NOT IN USE, the method doesn't do anything.
          * If the sequence number for a new node is IN USE, the method searches for the next free
          * sequence number by incrementing the number by one and repeating the query until no result
          * is found. Then all the sequence numbers between the required number (including, >= relation)
          * and the nearest found free number (not including, < relation) are incremented by 1, as to
          * make space for the new node.
          * @param connection
          * @param catalogue
          * @param newNodeSequenceNumber required sequence number for the new node
         private void setSequenceNumbers(OracleConnection connection, String catalogue, int newNodeSequenceNumber) {
              // 1. check if the new sequence number exists - if no do nothing
              // if yes - increment by one and see if exists
              //           repeat until free sequence number exists
              // when found increment all sequence numbers freeSeqNr > seqNr >= newSeqNr
              String query = "SELECT sort_sequence FROM vstd_media_cat_attributes " +
                        "WHERE catalogue=:1 AND sort_sequence=:2";
              PreparedStatement ps;
              try {
                   ps = connection.prepareStatement(query);
                   ps.setString(1, catalogue);
                   ps.setInt(2, newNodeSequenceNumber);               
                   ResultSet rs = ps.executeQuery();
                   // if no result, the required sequence number is free - nothing to do
                   if( rs.next() ) {
                        int freeSequenceNumber = newNodeSequenceNumber;
                        do {
                             ps.setString(1, catalogue);
                             ps.setInt(2, freeSequenceNumber++);
                             rs = ps.executeQuery();
                        } while( rs.next() );
                        // increment sequence numbers - call stored procedure
                        String callUpdateSeqeunceNrs = "{ call fasi_lob.pack_gliederung.updateSeqNumbers(:1, :2, :3) }";
                        CallableStatement cst = connection.prepareCall(callUpdateSeqeunceNrs);
                        cst.setString(1, catalogue);
                        cst.setInt(2, newNodeSequenceNumber);
                        cst.setInt(3, freeSequenceNumber);
                        cst.execute();
                        cst.close();
    //                    String query2 = "UPDATE vstd_media_cat_attributes " +
    //                                      "SET sort_sequence = (sort_sequence + 1 ) " +
    //                                      "WHERE catalogue=:1 sort_sequnce >=:2 AND sort_sequence <:3";
    //                    PreparedStatement ps2;
    //                    ps2 = connection.prepareStatement(query2);
    //                    ps2.setString(1, catalogue);
    //                    ps2.setInt(2, newNodeSequenceNumber);
    //                    ps2.setInt(3, freeSequenceNumber);
    //                    ps.executeUpdate();
    //                    ps.close();
                   } // end of if block
                   rs.close();
              } catch (SQLException e) {
                   e.printStackTrace();
          * This method finds the last sequence number preceding the sequence number of a node
          * that is going to be inserted. The preceding sequence number is required to calculate
          * the sequence number of the new node.
          * We perform a hierarchical query starting from the parent node: if a result is returned,
          * we assign the parent's farthest descendant's node sequence number; if no result
          * is returned, we assign the parent's sequence number.
          * @param connection
          * @param catalogue
          * @param parent_attr parent attribute of the new node
          * @return
         private int getPrecedingSequenceNumber(OracleConnection connection, String catalogue, String parent_attr) {
              int sequenceNumber = 0;
              String query = "SELECT sort_sequence FROM vstd_media_cat_attributes " +
                                "WHERE catalogue=:1 " +
                                "CONNECT BY PRIOR attribute = parent_attr START WITH parent_attr=:2 " +
                                "ORDER BY sort_sequence DESC";
              try {
                   PreparedStatement ps = connection.prepareStatement(query);
                   ps.setString(1, catalogue);
                   ps.setString(2, parent_attr);
                   ResultSet rs = ps.executeQuery();
                   if ( rs.next() ) {
                        sequenceNumber = rs.getInt("sort_sequence");
                   } else {
                        // TODO: ggf fetch from request!
                        sequenceNumber = -1;
                   rs.close();
                   ps.close();
              } catch (SQLException e) {
                   e.printStackTrace();
              return sequenceNumber;
    }

    After further googling I figured out what was causing the problem: in eclipse I was referring to external libraries located in eclipse/plugins directory, whereas Tomcat was referring to the same libraries (possibly older versions) in it's common/lib directory.

  • Unable to connect the server, while open the rpt file in server from java.

    Hi,
    I have written one java class, that class deployed in solaris server. The BO server is avilable in another solaris server. i want to convert the rpt file to pdf format. for that i try to give the file path to the server for opening the rpt file, that time i got the follwoing error:
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException:
    Unable to connect to the server: uinbrdcsap02. --- Connection refused
    (errno:239)---- Error code:-2147217387 Error code name:connectServer
            at
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException.throwR
    eportSDKServerException(Unknown Source)
            at
    com.crystaldecisions.proxy.remoteagent.TCPIPCommunicationAdapter.connect
    (Unknown Source)
            at com.crystaldecisions.proxy.remoteagent.z.a(Unknown Source)
            at
    com.crystaldecisions.sdk.occa.report.application.ReportAppSession.int(Un
    known Source)
            at
    com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initia
    lize(Unknown Source)
    *My java code is the following ..*
    package com.ramco.report;
    //Crystal Java Reporting Component (JRC) imports.     
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.ByteArrayInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ByteArrayOutputStream;
    import java.sql.Connection;
    import java.sql.CallableStatement;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.text.SimpleDateFormat;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ExportOptions;
    import java.util.Calendar;
    import java.util.Properties;
    import org.apache.log4j.Logger;
    import org.apache.log4j.SimpleLayout;
    import org.apache.log4j.FileAppender;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    // Class file starting.
    public class StandardReconReport
         private Connection objConnection = null;
         private DBConnection dbconnection = null;
         private ByteArrayInputStream byteArrayInputStream =null;
         private FileOutputStream fileOutputStream = null;     
         private ByteArrayOutputStream byteArrayOutputStream = null;
         private CallableStatement callablestatement = null;
         private CallableStatement callablestatement1 = null;     
         private ResultSet resultset1 = null;
         private ResultSet resultset = null;
         private String Deal_No = null;
         private String Job_Date = null;     
         private String Reportservername = null;
         private SimpleLayout layout   = null;
         private FileAppender appender = null;
         private Logger logger            = null;
         private String     DateTimeFormat = null;
         private String Report_File_path =null;
         private String Pdf_File_Name = null;     
         private Properties properties = null;
         private String LogFilePath = null;
         private String FileName = null;
         private String FullLogFilePath = null;
         private Statement statement = null;
         private String Report_upload_path = null;
         private String StanReconDir = null;
         private String winandsol = null;
         private com.crystaldecisions.sdk.occa.report.application.ReportClientDocument  reportClientDoc = null;
         private int count_tmp=0;
         private String DATE_FORMAT = null;
         private String dateformat = null;
         private Calendar cal = null;
        private SimpleDateFormat sdf = null;
        private String reconfilename = null;    
         // Method for Generating Report.....
         private void stanReportGeneration()
              try
                   properties = new Properties();
                   properties.clear();
                 properties.load(new FileInputStream("GeneralInfo.properties"));
                 Reportservername = properties.getProperty("reportservername");
                 reconfilename = properties.getProperty("reconfilename");
                 layout = new SimpleLayout();
                   LogFilePath = properties.getProperty("logfilepath");               
                   dateformat = dateTime1(properties.getProperty("dateformat1"));
                   StanReconDir = properties.getProperty("stanrecondir");
                  winandsol = properties.getProperty("windowsandsolaris");        
                  if (new File(LogFilePath).exists())
                       LogFilePath = LogFilePathdateformatwinandsol;
                       if (new File(LogFilePath).exists())
                       else
                            new File(LogFilePath).mkdirs();
                  FileName = "STANRECONLOGFILE-";             
                  FileName = FileNamedateformat".txt";             
                  FullLogFilePath = LogFilePath+FileName;
                  appender = new FileAppender(layout,FullLogFilePath,false);
                 logger = Logger.getLogger("MyLogger");
                 logger.addAppender(appender);
                 DateTimeFormat = properties.getProperty("datetimeformat");       
                 logger.info("The Start Recon Report Start Time: " +dateTime(DateTimeFormat));             
                 logger.info("");            
                 try
                      InetAddress address[] = InetAddress.getAllByName(Reportservername);                 
                     for (int i=0; i<address.length;i++)
                          logger.info("Report Server Name: " + address<i>.getHostName());
                          logger.info("Report Server Address: " + address<i>.getHostAddress());
                          logger.info("Report Server Canonical: " + address<i>.getCanonicalHostName());
                 catch (UnknownHostException e)
                      logger.error("The host "Reportservername"is not avilable");
                 Report_File_path = properties.getProperty("StandardReconReportpath");          
                  logger.info("The Report File Name is : "+Report_File_path " - "dateTime(DateTimeFormat));
                  //Report_File_path="rassdk://"+Report_File_path;
                  try
                       //Getting the Database connection....
                       dbconnection = new DBConnection();
                      objConnection = dbconnection.getConnections();
                      statement = objConnection.createStatement();
                      String sqlQuery = "SELECT TRIM(PARAM_VALUE) FROM SYS_USER_PARAM WHERE COMPONENT = 'REPORT' AND LINE_NO = 1 AND PARAM_NAME = 'REPORT_DOWNLOADPATH' AND STATUS = 'A'";
                      resultset = statement.executeQuery(sqlQuery);
                      while(resultset.next())
                           Report_upload_path = resultset.getString(1);
                           logger.info("Report_upload_path from the DB: "+Report_upload_path);
                  catch (SQLException ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  catch(Exception ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  finally
                       if(statement!=null)
                            statement.close();
                       if(resultset!=null)
                            resultset.close();
                  if (new File(Report_upload_path).exists())
                       Report_upload_path = Report_upload_path+StanReconDir;
                       if (new File(Report_upload_path).exists())
                            System.out.println("Directory is avilable"+Report_upload_path);
                       else
                            new File(Report_upload_path).mkdirs();
                  Report_upload_path = Report_upload_pathwinandsoldateformat+winandsol;              
                  if (new File(Report_upload_path).exists())
                  else
                       new File(Report_upload_path).mkdirs();
                  logger.info("Report_upload_path : "Report_upload_path" : "+dateTime(DateTimeFormat));
                  try
                       logger.info("Calling the REPORT_STAN_RECON_CON SP : "+dateTime(DateTimeFormat));
                      callablestatement = objConnection.prepareCall("{call REPORT_STAN_RECON_CON(?)}");
                      callablestatement.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR);
                        callablestatement.execute();
                        resultset=(ResultSet)callablestatement.getObject(1);
                        if(resultset!=null)
                             while(resultset.next())
                                  count_tmp = count_tmp+1;
                                  logger.info("");                              
                                 Deal_No   = resultset.getString(1);
                                  Job_Date = resultset.getString(2);
                                  DATE_FORMAT = resultset.getString(3);
                                  Job_Date = Job_Date.substring(0,10);
                                  logger.info("*********** PDF Convertion Starting for a Deal No: " +Deal_No " :: "dateTime(DateTimeFormat));
                                  Pdf_File_Name = Report_upload_pathreconfilenameDeal_No"-"DATE_FORMAT+".pdf";                              
                                  Job_Date = Job_Date.replace('-', '/');
                                  logger.info("The Deal_No is : "+Deal_No " - "dateTime(DateTimeFormat));
                                  logger.info("The Job_Date is : "+Job_Date " - "dateTime(DateTimeFormat));
                                  try
                                     reportClientDoc = new com.crystaldecisions.sdk.occa.report.application.ReportClientDocument();
                                       reportClientDoc.setReportAppServer(Reportservername);                                   
                                       logger.info("Report App server Name := "+ reportClientDoc.getReportAppServer());
                                       logger.info("Report_File_path  := "+ Report_File_path);                             
                                       reportClientDoc.preCreateServerAgent(true);                            
                                       reportClientDoc.open(Report_File_path,0);                         
                                       logger.info("After opening the RTF file for : "+Deal_No " Deal_No - "dateTime(DateTimeFormat));
                                                 callablestatement1 = objConnection.prepareCall("{call REPORT_STANDARD_RECON(?,?,?,?)}");
                                       callablestatement1.setString(1, Job_Date);
                                       callablestatement1.setString(2, Deal_No);
                                       callablestatement1.setString(3,"");
                                       callablestatement1.registerOutParameter(4, oracle.jdbc.driver.OracleTypes.CURSOR);
                                       callablestatement1.execute();
                                       resultset1=(ResultSet)callablestatement1.getObject(4);
                                       String tableAlias = reportClientDoc.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
                                       reportClientDoc.refreshReportDocument();
                                       reportClientDoc.getDatabaseController().setDataSource(resultset1, tableAlias , "Result Set");
                                       reportClientDoc.refreshReportDocument();                         
                                       ExportOptions oExportOptions = new ExportOptions();
                                       oExportOptions.setExportFormatType(ReportExportFormat.RTF);
                                       byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
                                       logger.info("After exporting the report file to PDF file for the : "+Deal_No " Deal_No - "dateTime(DateTimeFormat));
                                       //Use the Java I/O libraries to write the exported content to the file system.
                                       byte byteArray[] = new byte[byteArrayInputStream.available()];     
                                       //Create a new file that will contain the exported result.
                                       logger.info("Successfully exported report to " + Report_File_path" - "dateTime(DateTimeFormat));
                                       logger.info("*********** PDF Convertion Ending for a Deal : "Deal_No" "+dateTime(DateTimeFormat));
                                       logger.info("");
                                       Deal_No   = null;
                                       Job_Date  = null;
                                  catch (SQLException ex)
                                      ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  catch (IOException ex)
                                      ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  catch (Exception ex)
                                       ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  finally
                                       if(byteArrayInputStream!=null)
                                            byteArrayInputStream.close();
                                       if(byteArrayOutputStream!=null)
                                            byteArrayOutputStream.close();
                                       if(fileOutputStream!=null)
                                            fileOutputStream.close();
                                       if(callablestatement1!=null)
                                            callablestatement1.close();
                                       if(resultset1!=null)
                                            resultset1.close();
                                       if(reportClientDoc!=null)
                                            reportClientDoc.close();
                        if(count_tmp==0)
                             logger.info("");
                             logger.info(" $$$$$$$$ There is NO DATA for generating the Report $$$$$$$: " +dateTime(DateTimeFormat));
                  catch (SQLException ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  catch (Exception ex)
                        ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  finally
                       if(callablestatement!=null)
                            callablestatement.close();
                       if(resultset!=null)
                            resultset.close();
                       if(objConnection!=null)
                            objConnection.close();
                       if(callablestatement1!=null)
                            callablestatement1.close();
                       if(resultset1!=null)
                            resultset1.close();
              catch (IOException ex)
                  ex.printStackTrace();
                  System.out.println(ex);
                  logger.error(ex);
              catch (Exception ex)
                   ex.printStackTrace();
                  System.out.println(ex);
                  logger.error(ex);
              finally
                  properties.clear();              
              logger.info("");
              logger.info("*******Standard Recon Report End Time*******: "+dateTime(DateTimeFormat));
         // Getting the current date and time..
         public String dateTime(String dateFormat)
              cal = Calendar.getInstance();
             sdf = new SimpleDateFormat(dateFormat);
             return sdf.format(cal.getTime());
         //Getting the Yesterday Date and time...
         public String dateTime1(String dateFormat)
              cal = Calendar.getInstance();
              cal.add(Calendar.DATE, -1);            
             sdf = new SimpleDateFormat(dateFormat);
             return sdf.format(cal.getTime());
         public static void main(String[] args) {
              StandardReconReport  SR = new StandardReconReport();
              SR.stanReportGeneration();
    For the above code  i given the report parameter from  the property file.
    reportservername=servername
    datagenreportpath=rassdk\://C\:
    MyEclipseWorkPlace
    IDSREPORTGENERATION
    REPORTFILES
    STANDARD_RECON_REPORT.rpt
    The code is working fin, while i try to connect the BO which is avilble in Windows server, but this is not working if the BO is avilble in solaris server.
    Any bodies please help
    Edited by: velmurugan.spn on Sep 12, 2009 6:38 AM

    Hi,
    Not able to find Report - Standard templates or Report - Custom templates view in Administration - BIP reports in Siebel 8.1.1.3?
    We have applied 8.1.1.3 patch on 8.1.1.0
    below are the steps followed
    Reports are not generated after 8.1.1.3 patch installtion.
    we have also followed to below steps mentioned for this issue in oracle support.
    "In order to resolve this behavior it is necessary to ensure that the 8.1.1.3 FixPack has been applied to the Siebel Tools installation. This will provide an additional .zip file in the REPPATCH folder of the Siebel Tools installation. Once this has been done please then follow the configuration steps as documented :
    change sysprefix to X_ before sif import and chage back to SBL_ after sif import.
    1) Import the sif files from Siebel\8.1\Tools_1\REPPATCH\12-1VMBCSV.zip
    2) Import the 4 SIF files in the following order:
    S_XMLP_REP_TMPL_02112010.sif
    SBL_XMLP_REPORT_SELECTION_FLG.sif
    Report Template BC.sif
    Report Template Registration Applet.sif
    3)Apply the DDL for table S_XMLP_REP_TMPL and compile repository
    Once the above steps have been completed the Selected Record flag will appear in the Report Template Registration views."
    we still not able to generated able to generate reports even after following above steps.
    Thanks
    Sean

  • Calling Stored Procedure with Paramters in Java

    Hi
    I havent done alot of sql/java work so I'm wondering if I could get some help.
    I have the java code
    private void processPatient(Element pat)
    throws PatientException,
    ParseException,
    SQLException,
    Exception {
    Connection con = null;
    ResultSet rs;
    CallableStatement cs;
    ...<code>
    cs = con.prepareCall("{call updt_pat.set_pat_ppe}");
    rs = cs.executeQuery();
    Does this look correct? The proc updt_pat.set_pat_ppe also takes an int parameter...how would I modify this to accept the paramter? Like
    cs = con.prepareCall("{call updt_pat.set_pat_ppe paramter}");
    Thanks for the help!!
    Mani

    The actual implementation of what the setInt does and how it does it is up the JDBC driver vendor. Basically its function is as follows (implementation will be driver specific) it takes the int value and passes it to the Stored Procedure being called as the (in this case) 1st input parameter expected by the stored procedure. Whatever the name of the IN variable is within the stored procedure is irrelevant to the JDBC code, basically it will be assigned to the name of the first IN parameter within the Stored Procedure.
    The error you are reporting:
    xxx.java:272: cannot resolve symbol
    symbol : method setInt (java.lang.Integer,int)
    location: interface java.sql.CallableStatement
    cs.setInt(1, ppath.getPatId());
    ^
    1 error
    is interesting as it is claiming that the setInt method requires as its first argument an Integer object - this is not what the specification requires, it just wants an index number as a Java int:
    setInt(int index, int value), note no java.lang.Integer
    maybe this is a driver specific implementation?
    Try the following (not in any specific order):
    1 - int value = ppath.getPatId();
    cs.setInt(1, value);
    2 - Integer index = new Integer(1);
    cs.setInt(index , ppath.getPatId());
    3 - int = ppath.getPatId();
    Integer index = new Integer(1);
    cs.setInt(index , value);
    Let me know if this solves your problem.

  • Can we call sql function  in java

    as i know i can call stored procedures ,but can i call pl/sql functions.

    Using JDBC you can execute any valid sql statement.
    For a pl/sql function you use a CallableStatement and the syntax:
    {?= call <procedure-name>[<arg1>,<arg2>, ...]}
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/CallableStatement.html

  • SDO_UTIL.FROM_KMLGEOMETRY and Java

    Hello,
    I'm trying to write a Java program that will parse a KML file, convert KML geometry coordinates into SDO_GEOMETRY coordinates, then insert appropriate records into the database.
    I'm stuck on the 2nd part, converting KML into SDO_GEOMETRY. Here's my code:
    private static void getSDOGeom(Connection con, String [] geomKML, JGeometry [] geomSDO) throws Exception {
    CallableStatement s = con.prepareCall("{? = call SDO_UTIL.FROM_KMLGEOMETRY(?)}");
    ResultSet rs = null;
    for (int i = 0; i < geomKML.length; i++) {
    s.registerOutParameter(1, JGeometry.GTYPE_POINT);
    s.setString(2, "\'<Point><coordinates>" + geomKML[i] + "</coordinates></Point>\'");
    rs = s.executeQuery();
    geomSDO[i] = (JGeometry) s.getObject(1);
    Here's my error message:
    java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    -then stack trace saying which line of my program caused the error - the executeQuery line.
    It looks like my problem is from the JGeometry.GTYPE_POINT in the registerOutParameter method call. I've tried a number of items here to no effect. The geomKML array contains KML coordinates stripped from a KML/XML file, I had to put the <Point> and <coordinates> tags in because the XML parser isn't including them. I've converted coordinates directly in the database, so I know the KML input is correct. The geomSDO array is of the proper size, but is null. I'm not sure what I'm doing wrong and can't find anything like this in the forums. A DB guy here at work did some searching and said I should use JGeometry, but he's not sure why it isn't working either.
    Anyone have any ideas?

    Thanks for the help... my problem was the ResultSet. I didn't noticed until your most recent code example that you weren't using it, but were acting upon the CallableStatement directly for the getObject method. I was using CallableStatement wrong. I think I saw an example somewhere with the CallableStatement and the ResultSet both being used. Thanks for the STRUCT code too, I saw something about that in a forum post, but wasn't sure what it was doing... but my code doesn't work without it. I did have to track down the jar libraries and imports for STRUCT and OracleType, but that wasn't too difficult.
    As to your other points, there is a bit of a misunderstanding because of the limited information I posted - I should have been more clear. This method is one method in a larger program - my database connection was already set up and working, though I thank you for being proactive and including it just in case. I was also printing out my KML coordinates to check to make sure they were ok and had already tested them in the database with a written procedure and knew they were working. The "\" was an escape character for a single quote, which I thought I needed to include because the input to FROM_KMLGEOMETRY needed to be surrounded by single quotes in the database testing. Your initial response also included them. I found that by removing them, my error went away - in fact, I didn't even notice they were there at first. Finally, the JGeometry array does indeed work and the array list isn't needed. I was hoping the array would work as it's more light weight and I'm able to pass the object by reference instead of by value, decreasing the overhead of my code. I was delighted to find that it did work once I fixed the ResultSet issue as previously mentioned. It is initialized elsewhere in my code to be the same size as the array with the KML geometry.
    I don't add the comments above to rebuff you. I'm very glad to you provided extremely complete answers. You've helped me before. I add them in case someone else stumbles upon this thread in hopes that the information will be useful to them.
    For posterity, Final code with related imports:
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import oracle.spatial.geometry.JGeometry;
    import oracle.jdbc.OracleTypes;
    import oracle.sql.STRUCT;
    private static void getSDOGeom(Connection con, String [] geomKML, JGeometry [] geomSDO) throws Exception {
    CallableStatement s = con.prepareCall("{? = call SDO_UTIL.FROM_KMLGEOMETRY(?)}");
    STRUCT geomSDO_STRUCT = null;
    for (int i = 0; i < geomKML.length; i++) {
    s.registerOutParameter(1, OracleTypes.STRUCT, "MDSYS.SDO_GEOMETRY");
    // You could also add extrude, tessellate and altitudeMode
    s.setString(2, "<Point><extrude>0</extrude><tessellate>0</tessellate>" +
    "<altitudeMode>clampToGround</altitudeMode><coordinates>" + geomKML[i] +
    "</coordinates><extrude>0</extrude><tessellate>0</tessellate>" +
    "<altitudeMode>clampToGround</altitudeMode></Point>");
    s.executeQuery();
    geomSDO_STRUCT = (STRUCT) s.getObject(1);
    geomSDO[i] = JGeometry.load(geomSDO_STRUCT);
    s.close();
    The libraries that I needed to add to the project at compile time (already had the jdbc driver loaded for runtime) are
    sdoapi.jar (this is for JGeometry and other spatial related items) located <oracle home>/md/jlib/
    ojdbc6.jar (this is where the STRUCT and OracleTypes are found) located <oracle home>/jdbc/lib/
    Thanks,
    Edit:
    If you're trying to write SDO_GEOMETRY to a database, this thread will help.
    ORA-00939: too many arguments for function
    Edited by: J-rd-n on Sep 14, 2010 11:44 AM

Maybe you are looking for