About JDBC CALL STORE PROCEDURE with out parameter is greater than 4000

Hi Guys,
I have a problem call store procedure with a large string.
as i know varchar2 can contain 32767 characters in pl/sql .
But when i used varchar2 as a out parameter in a store procedure, if the out parameter is greater than 4000 characters , it always give me error message as 'the buffer is too small'.
why it happened?
I read some article that says i need configure a property in data-source.xml , and jdbc 10g driver already solved this problem, but i used jdev 10.1.3.2 ,the driver should be fine.
How can i solve this problem?
Thanks in advance,
AppCat

Object is Foundation, Execute Script
This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
conn = ds.getConnection();
stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
rs = stmt.executeQuery();
rs.next();
patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
} finally {
try {
rs.close();
} catch (Exception rse) {}
try {
stmt.close();
} catch (Exception sse) {}
try {
conn.close();
} catch (Exception cse) {}

Similar Messages

  • Call stored procedure with OUT parameter

    Hello,
    I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
    The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
    Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
    Has someone been able to call a stored procedure with an OUT parameter?
    Regards,
    Nico

    Object is Foundation, Execute Script
    This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    import java.sql.*;
    PreparedStatement stmt = null;
    Connection conn = null;
    ResultSet rs = null;
    try {
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
    conn = ds.getConnection();
    stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
    stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
    rs = stmt.executeQuery();
    rs.next();
    patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
    } finally {
    try {
    rs.close();
    } catch (Exception rse) {}
    try {
    stmt.close();
    } catch (Exception sse) {}
    try {
    conn.close();
    } catch (Exception cse) {}

  • How to call a Store Procedure with IN PARAMETER

    Hi, im new using Oracle 10G with Oracle SQL Developer, my cuestion is how to call a Store Procedure with IN PARAMETER, I tried the following without results
    SELECT * FROM procedure_name(parameter);
    PROCEDURE procedure_name(parameter);
    EXEC procedure_name(parameter);
    CALL procedure_name(parameter);
    Please help me....

    Hi,
    As Beijing said,
    EXEC procedure_name(parameter);
    CALL procedure_name(parameter);work for me.
    So does
    BEGIN
        procedure_name(parameter);
    END;Can you be more specific about what you're doing? That is, are you testing it in SQL Developer? Where are you entering the commands? Where are you looking for output? Do you get error messages? Does anything else (like "SELECT SYSDATE FROM dual;") work?

  • Please help to call oracle procedure with out paramter from shell script

    Hi
    I want to call a process with out parameter from shell script. I am calling process in shell script in below way
    function Process_loads {
    ( echo 'set serveroutput on size 1000000 arraysize 1'
    echo "set pagesize 0 term on verify off feedback off echo off"
    echo "BEGIN"
    echo " dbms_output.put_line('Before Calling The package'); "
    echo " x ( '$1', '$2', '$2', '$4', '$5', '$error_code'); "
    echo " dbms_output.put_line('After Calling The package'); "
    echo "EXCEPTION "
    echo " WHEN OTHERS THEN "
    echo " dbms_output.put_line('BIN_LOAD_ERROR' || SQLERRM); "
    echo " ROLLBACK;"
    echo "END;"
    echo "/" ) | sqlplus -s $USER/$PASSWORD@$SID
    Here $error_code is out paramter. All varaibles passed in process are declared with export command.
    When executing .sh it gives below error
    "sh ERROR at line 3: ORA-06550: line 3, column 99: PLS-00363: expression '' cannot be used as an assignment target ORA-06550: line 3, column 3: PL/SQL: Statement ignored".
    Please help to get rid from this error or please suggest how to call a oracle procedure with out paramter from unix shell script.
    Thanks in advance

    You can try this:
    From sql*plus
    SQL> ed
      1  create or replace procedure my_proc(p_id in int, p_result out int)
      2  as
      3  begin
      4  select 10 * p_id
      5  into p_result
      6  from dual;
      7* end my_proc;
    SQL> /
    Procedure created.
    SQL> set serveroutput on
    SQL> declare
      2  v_r int;
      3  begin
      4  my_proc(10,v_r);
      5  dbms_output.put_line(v_r);
      6  end;
      7  /
    100
    PL/SQL procedure successfully completed.
    from bash:
    testproc.sh:
    #!/bin/bash
    (echo 'set serveroutput on';
    echo 'declare';
    echo 'v_r int;';
    echo 'begin';
    echo 'my_proc(10,v_r);';
    echo 'dbms_output.put_line(v_r);'
    echo 'end;';
    echo '/';) | sqlplus -s u1/u1
    Console:
    oracle@mob-ubuntu:~$ chmod u+x testproc.sh
    oracle@mob-ubuntu:~$ ./testproc.sh
    100
    PL/SQL procedure successfully completed.With kind regards
    Krystian Zieja

  • How to write a shell script to execute a procedure with out parameter

    Hi,
    How to write a shell script to execute a procedure with out parameter.
    here is my procedure
    PROCEDURE sample(invar1 VARCHAR2,
    invar2 VARCHAR2,
    invar3 VARCHAR2,
    invar4 VARCHAR2,
    ecode out number);
    Any example really helpfull
    Thanks in advance

    Or if we're passing values in, maybe something like:
    Test procedure:
    CREATE OR REPLACE PROCEDURE p (myin IN VARCHAR2, myout OUT VARCHAR2)
    AS
    BEGIN
        myout :=
            CASE myin
                WHEN 'A' THEN 'APPLE'
                WHEN 'B' THEN 'BANANA'
                ELSE 'STARFRUIT'
            END;
    END;Shell script:
    #!/bin/bash
    my_shell_variable=$1
    unset ORACLE_PATH
    sqlplus -s un/pw@db <<-EOF
    set feedback off pause off
    set pagesize 0
    set autoprint off
    VAR out varchar2(30)
    VAR myin varchar2(30)
    exec :myin := '${my_shell_variable}'
    BEGIN
      p(:myin, :out);
    END;
    print out
    exit
    EOFTest:
    /Users/williamr: xx A
    APPLE
    /Users/williamr: xx B
    BANANA
    /Users/williamr: xx
    STARFRUITObviously in a real script you would not hardcode the password or let it show in a "ps" listing.
    Message was edited by:
    William Robertson

  • Procedure with out parameter in if-then-else condition

    Hi,
    I want to fetch the out parameter of a procedure inside another procedure that has if-then-else condition.
    <<Proc1_start>>
    if ..
    then <<proc2_>> --- with out parameter
    end if;
    <<proc1_end>>
    How to do this...
    Thanks.

    Ummm, the same way you would do it anywhere else?
    Declare variable in proc1 to hold the output of proc2 and then call proc2.
    John

  • Execute procedure with out parameter in sql*plus

    HI All,
    I am executing an stored proc with OUT parameter from sql*plus.
    Getting this error message:
    SQL> execute sp1_cr_ln_num('01',0,3);
    BEGIN sp1_cr_ln_num('01',0,3); END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to
    'sp1_cr_ln_num'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Whereas it works fine using Toad. 4th parameter is for output.
    Thanks.

    then you can see the value either using print :var or execute dbms_output.put_line(:var)

  • Calling Stored Procedure with CLOB parameter

    Hi,
    i have one procedure with IN parameter CLOB which is taking xml file and stored in one table column and this table column datatype is also CLOB. And this procedure called by .Net program but problem is when the file will come more than 32KB calling procedure failed. But as i know CLOB can stored up to 4GB data.
    Is that Limitation of oracle or .Net version
    please let me know the solution for that,
    Create Procedure Insert_File(P_XMLFILE IN CLOB)
    as
    begin
    insert into instances
    values(p_xmlfile);
    commit;
    end;
    regards,
    Madan

    Hi Thanks for your reply,
    Actually this procedure called by .net program and the XML file has passed in that parameter which come from some FTP(its inbound) and this files we are storing into above mentioned table.
    Error has come while calling stored procedure Through .net
    Error Details:
    Error calling stored procedure. 0 retry attemps has failed. Error: System.Exception: Error while calling stored procedure on Oracle: INSERT_FILE: System.Data.OracleClient.OracleException: ORA-01460: unimplemented or unreasonable conversion requested

  • Oracle Stored Procedure with out parameter

    Good morning,
    Is it possible to use an Oracle stored procedure with out parameters in MII ?
    If yes, what is the manipulation to see the values of parameters Out?
    Thank you

    Michael,
    This is the  MII query template  :
    DECLARE
    STRCOMPTERENDU NVARCHAR2(200);
    BEGIN
    STRCOMPTERENDU := NULL;
    XMII.SP_VALIDATEPROCESSORDERSLIST2 ( STRCOMPTERENDU => [Param.1]  );
    COMMIT;
    END;
    and the stocked procedure code
    CREATE OR REPLACE PROCEDURE XMII.SP_ValidateProcessOrdersList2(strCompteRendu OUT nVarchar2) IS
    tmpVar NUMBER;
    debugmode INT;
    strClauseSql varchar(2048);
    strListPOactif varchar(1024);
    dtmTimeStamp DATE;
       NAME:       SP_ValidateProcessOrdersList
       PURPOSE:   
       REVISIONS:
       Ver        Date        Author           Description
       1.0        18/06/2008          1. Created this procedure.
       NOTES:
       Automatically available Auto Replace Keywords:
          Object Name:     SP_ValidateProcessOrdersList
          Sysdate:         18/06/2008
          Date and Time:   18/06/2008, 18:45:32, and 18/06/2008 18:45:32
          Username:         (set in TOAD Options, Procedure Editor)
          Table Name:       (set in the "New PL/SQL Object" dialog)
    BEGIN
       tmpVar := 0;
       debugmode := 0;
       -- lecture date systeme pour time stamp
       select sysdate  into dtmTimeStamp from dual;
       if debugmode = 1 then
        DBMS_OUTPUT.put_line('SP_ValidateProcessOrdersList');
       end if;
       -- insertion du bloc dans le log
       insert into LOG_ORDER
        (DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
       values
       (dtmTimeStamp,'SP_ValidateProcessOrdersList',ID_LOG_ORDER.nextval);
       Commit;
        if debugmode = 1 then
        DBMS_OUTPUT.put_line('insertion LOG OK');
       end if;
    strCompteRendu := '0123456-896;0123456-897';
    commit; 
       EXCEPTION
         WHEN NO_DATA_FOUND THEN
           NULL;
         WHEN OTHERS THEN
         ROLLBACK;
         -- insertion du bloc dans le log
       insert into LOG_ORDER
        (DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
       values
       (dtmTimeStamp,' ',ID_LOG_ORDER.nextval);
       COMMIT;
           -- Consider logging the error and then re-raise
           RAISE;
    END SP_ValidateProcessOrdersList2;
    Thanks for your help
    Alexandre

  • Error while calling a stored procedure with OUT parameter.

    Hi,
    I am trying to call a Stored Procedure(SP) with an OUT parameter(Ref Cursor) from a third party tool. It is called using OLE-DB Data provider. In one database the procedure works fine but when I change the database the procedure call is giving following error.
    Distribution Object:     COM Error. COM Source: OraOLEDB. COM Error message: IDispatch error #3092. COM Description: ORA-06550: line 1, column 7:
         PLS-00306: wrong number or types of arguments in call to 'TEST1'
         ORA-06550: line 1, column 7:
         PL/SQL: Statement ignored.
    I am not able to find as to why is this happening. Please let me know any clues /help to solve this problem.
    Thanks in advance.

    If you're using Oracle Provider for OLE DB (OraOLEDB) to execute this stored procedure, you need to set PLSQLRSet attribute. This attribute can be set in registry, connection string, or command object. Please refer to User Documentation for more information.

  • Calling Oracle Stored procedure with OUT parameter from ODI

    Hi,
    I called an oracle stored procedure with following anonymous block in the ODI procedure.
    Declare
    Status varchar2(10);
    Begin
    OTM.DeleteTarget('E_KPI_TARGET_VALUE', Status);
    End;
    I want to capture the OUT parameter STATUS value in a project level variable.
    And based on its va;lue I would like to choose between 2 interfaces in my package.
    Please help me in doing this.

    Hi,
    For that kind of situation I commoly use:
    1) one step with:
    create or replace package <%=odiRef.getSchemaName("W")%>.pck_var
    Status varchar2(10);
    end;
    * transaction 9, for instance
    2) step
    Begin
    OTM.DeleteTarget('E_KPI_TARGET_VALUE', <%=odiRef.getSchemaName("W")%>.pck_var.Status);
    End;
    * transaction 9
    3) then, at an ODI variable, use a refresh like:
    select <%=odiRef.getSchemaName("W")%>.pck_var.Status from dual
    at same logical shema where the package was created.
    Does it make sense to you?

  • Call Procedure with OUT Parameter

    Hi,
    When I use an Procedure that has an OUT Parameter
    how can I use these OUT Parameter as an IN Parameter for an another Procedure.
    thanks
    Marcel

    Not sure, but is the following you after,
    SQL> create or replace procedure p1_out (a out number)
      2  as
      3  begin
      4  a := 10;
      5  end;
      6  /
    Procedure created.
    SQL> create or replace procedure p1_in (a in number)
      2  as
      3  begin
      4  dbms_output.put_line(a);
      5  end;
      6  /
    Procedure created.
    SQL> declare
      2  a number;
      3  begin
      4  p1_out(a);
      5  p1_in(a);
      6  end;
      7  /
    10
    PL/SQL procedure successfully completed.
    SQL>

  • Execute immediate for stored procedure with out parameter

    Hi,
    I have problem with dynamically executing the statement hope anyone can help me.
    I have a table which stores the procedure names. and procedure parameter values are stored on another column with parameter values coming from java side.
    I have to create a procedure that dynamically executes the procedure on table1 with the values from table 2.
    Now I'm getting real trouble to execute immediate this proc with parameters. I tried the DBMS_SQL package as well.
    Problem is you need to mention the OUT mode specifically for the out parameter. Can anybody plz help me with this issue??
    TABLE1_
    PROCESS_ID     PROC_NAME
    1      proc1(p1 IN number, p2 IN varchar2, p3 OUT varchar2)
    2     proc2(p1 IN number, p2 out varchar2, p3 OUT varchar2)
    TABLE2_
    PROCESS_ID     PROC_PARMS
    1     100, 'test', :return
    2     200, :return1, :return2
    Thank You

    826957 wrote:
    Hi,
    I have problem with dynamically executing the statement hope anyone can help me.
    I have a table which stores the procedure names. and procedure parameter values are stored on another column with parameter values coming from java side.
    I have to create a procedure that dynamically executes the procedure on table1 with the values from table 2.
    Now I'm getting real trouble to execute immediate this proc with parameters. I tried the DBMS_SQL package as well.
    Problem is you need to mention the OUT mode specifically for the out parameter. Can anybody plz help me with this issue??
    TABLE1_
    PROCESS_ID     PROC_NAME
    1      proc1(p1 IN number, p2 IN varchar2, p3 OUT varchar2)
    2     proc2(p1 IN number, p2 out varchar2, p3 OUT varchar2)
    TABLE2_
    PROCESS_ID     PROC_PARMS
    1     100, 'test', :return
    2     200, :return1, :return2
    Thank YouSounds like an appalling design and a nightmare waiting to happen.
    Why not have your Java just call the correct procedures directly?
    Such design smells badly of an entity attribute value modelling style of coding. Notoriously slow, notoriously buggy, notoriously hard to maintain, notoriously hard to read. It really shouldn't be done like that.

  • Invoking Stored Procedure with OUT Parameter

    I am calling a stored procedure that has a "out" parameter of PL/SQL type (table of varchar2) through toplink API. My procedure executes, performs the updates successfully, but I can not obtain the value of the out parameter. Is the approach followed below incorrect? I could not figure out by looking into examples provided in the documentation:
    http://download.oracle.com/docs/cd/B25221_04/web.1013/b25386/building_and_using_application_services009.htm#BCFEFAHC
    Java function is given below:
    public List removeFromAutoupdSched( List srNumbers, String userName)
    if (srNumbers == null || srNumbers.size() == 0)
    return null;
    List result = null;
    try
    //Example Stored procedure call with an output parameter
    DatabaseLogin login = m_dbSess.getLogin();
    Connection conn = (Connection) (java.sql.Connection)login.connectToDatasource(null);
    oracle.sql.ArrayDescriptor arrDesc = new oracle.sql.ArrayDescriptor("AUTOUPD_SRLIST_T", conn);
    oracle.sql.ARRAY srARR = new oracle.sql.ARRAY(arrDesc, conn, srNumbers.toArray());
    StoredProcedureCall procCall = new StoredProcedureCall();
    procCall.setProcedureName("SEW_AUTOUPD.PURGE_AUTOUPD_SCHEDULE");
    procCall.addNamedArgumentValue("excludeSRlist", srARR);
    procCall.addNamedArgumentValue("exclude_by", userName);
    procCall.addNamedOutputArgument(
    "excludeSR_srlist_status",
    "excludeSR_srlist_status",
    OracleTypes.ARRAY,
    "AUTOUPD_SRLIST_ERRS_T"
    ValueReadQuery vq = new ValueReadQuery();
    vq.setCall(procCall);
    oracle.sql.ARRAY srResultARR = (oracle.sql.ARRAY)m_dbSess.executeQuery(vq);
    if (srResultARR != null)
    String[] msgs = (String[])srResultARR.getArray();
    if (msgs.length > 0)
    result = Arrays.asList(msgs);
    Iterator iter = result.iterator();
    while (iter.hasNext())
    System.out.println("msg = " + iter.next());
    return result;
    catch (Exception exc)
    throw new RuntimeException(exc);
    PL/SQL Type
    create or replace TYPE autoupd_srlist_errs_t IS TABLE OF VARCHAR2(150);
    Sample procedure called by toplink:
    PROCEDURE purge_autoupd_schedule(
    excludeSRlist autoupd_srlist_t,
    exclude_by VARCHAR2,
    excludeSR_srlist_status OUT NOCOPY autoupd_srlist_errs_t)
    IS
    pkg sew_log.pkg_name%TYPE default upper('sew_autoupd');
    prc sew_log.prc_name%TYPE default upper('purge_autoupd_schedule(excludeSRlist, exclude_by)');
    srno NUMBER;
    -- cnt NUMBER := 0;
    exclude_status VARCHAR2(150);
    err_prefix VARCHAR2(50) := 'Unable to exclude from autoupdate, ';
    BEGIN
    FOR i IN excludeSRlist.FIRST..excludeSRlist.LAST
    LOOP
    BEGIN
    srno := excludeSRlist(i);
    -- Update actn_taken column in autoupd_schedule before doing delete.
    UPDATE autoupd_schedule SET actn_taken='Removed by engineer', UPD_TIME=systimestamp
    WHERE sr_no = srno and engr_itsid = exclude_by;
    -- Add SR to exclusion list.
    INSERT INTO autoupd_exclude(sr_no, exclude_by, exclude_time) VALUES (srno, exclude_by, systimestamp);
    exclude_status := 'Item ' || i || ' - SR ' || srno || ' - ' || 'Excluded from autoupdate.';
    excludeSR_srlist_status(i) := exclude_status;
    EXCEPTION
    WHEN others THEN
    -- Add SR to excludeSR_fail if previous steps occurred okay.
    -- cnt := cnt +1;
    exclude_status := 'Item ' || i || ' - SR ' || srno || ' - ' || err_prefix || substr(sqlerrm,12);
    excludeSR_srlist_status(i) := exclude_status;
    END;
    END LOOP;
    EXCEPTION
    WHEN others THEN
    sew_logger.log(
    code => substr(sqlerrm,1,9),
    msg => substr(sqlerrm,12),
    pkg => pkg,
    prc => prc
    END;
    Any help is appreciated.

    What happens if you run the stored procedure through pure jdbc (without TopLink)?
    I tried a simple example that worked for me:
    //defined type in the db
    CREATE TYPE "TEST"."VAR_LIST" AS  TABLE OF VARCHAR2(150)
    //defined stored procedure in the db
    CREATE OR REPLACE  PROCEDURE "TEST"."VAR_LIST_IN_OUT"  (
    VARS_IN VAR_LIST,
    VARS_OUT OUT NOCOPY VAR_LIST
    as
    begin
      VARS_OUT := VAR_LIST();
      FOR i IN VARS_IN.FIRST..VARS_IN.LAST LOOP
        VARS_OUT.EXTEND;
        VARS_OUT(i) := CONCAT(VARS_IN(i), '_BLAH');
      END LOOP;
    end;
    // Java code
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("VAR_LIST_IN_OUT");
    Connection conn = (Connection) ((oracle.toplink.internal.sessions.AbstractSession)getSession()).getAccessor().getConnection();
    oracle.sql.ArrayDescriptor arrDesc = new oracle.sql.ArrayDescriptor("VAR_LIST", conn);
    oracle.sql.ARRAY srARR = new oracle.sql.ARRAY(arrDesc, conn, new String[]{"A1", "A2", "A3"});
    call.addNamedArgumentValue("VARS_IN", srARR);
    call.addNamedOutputArgument("VARS_OUT", "VARS_OUT", Types.ARRAY, "VAR_LIST");
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    Object result = getSession().executeQuery(query);
    Object[] array = (Object[])((java.sql.Array)result).getArray();
    for(int i=0; i<array.length; i++) {
        System.out.println(array);
    // System.out:
    [TopLink Finest]: 2008.04.25 15:37:16.687--DatabaseSessionImpl(3491657)--Thread(Thread[main,5,main])--Execute query ValueReadQuery()
    [TopLink Fine]: 2008.04.25 15:37:16.703--DatabaseSessionImpl(3491657)--Connection(29118152)--Thread(Thread[main,5,main])--BEGIN VAR_LIST_IN_OUT(VARS_IN=>?, VARS_OUT=>?); END;
         bind => [oracle.sql.ARRAY@323274, => VARS_OUT] (There is no English translation for this message.)
    A1_BLAH
    A2_BLAH
    A3_BLAH
    My stored procedure didn't work (on Oracle 9 db) without output collection initialization: VARS_OUT := VAR_LIST(); and extending: VARS_OUT.EXTEND.

  • Call store procedure wich have parameter from html

    Hi all,
    I have search function, which will allow users to select all database.
    I want to use stor procedure to handle this part , if it is a sample select procedure than just using
    CallableStatement cs = conn.prepareCall("{call SHow_SubType}");
                     ResultSet rs = cs.executeQuery();but if the store procedure have parameter
    like
    union 
    select FieldNumber, Name, HiTiter, SubType, Storage,SampleRegion, SampleYear
            from yunnan.dbo.ViruName04    
         where SubType like'%@SubType%'        
            and Name like'%@Name%'How can I call this stored procedure in my bean
    I have
    public String getName() {
        return name;
      public void setName(String _name) {
        name = _name;
    .....thankyou

    Hi ram,
    I try every hard, but still can't got result.
    my code is
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.sql.*;
    * TryJdbc.java
    * This servlet demonstrates using JDBC
    public class displayT extends HttpServlet {
       CallableStatement cs = null;
        ResultSet rs = null;
        Connection conn = null;
       * We want to initialized the JDBC connections here
        public void init()
            try{
            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
            catch( Exception e )
                e.printStackTrace();
       * This responds to an HTTP GET request.
        public void doGet(
        HttpServletRequest req,
        HttpServletResponse response)
        throws IOException, ServletException {
           String string= req.getParameter("string").trim();             
           String Type =req.getParameter("myType").trim();
            response.setContentType("text/html");
        PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head>");        
            try{
                conn = DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;selectMethod=cursor","test","1234" );
                DatabaseMetaData md = conn.getMetaData();
                //select a database
                conn.setCatalog("HKData");
           //we made it!
            out.println("connection established sucessfully!");
                CallableStatement cs = conn.prepareCall("call SHow_SubType(?,?)}");
                  cs.setString(1, "Dk");
                   cs.setString(2,"H5");
              // register int OUT parameter
         cs.registerOutParameter( 1, java.sql.Types.VARCHAR);
         cs.registerOutParameter( 2, java.sql.Types.VARCHAR);
                     ResultSet rs = cs.executeQuery();       
                  rs = (ResultSet)cs.getObject(1);
          while(rs.next()) {
          // String Name=rs.getString(2);    
           // out.print(""+Name+"");
           // out.print("br");
           System.out.println(rs.getString(1));
            out.print("</body></html>");
              out.close();
         cs = null;
    conn.close();
    conn = null;
    catch(NullPointerException sqle)
    sqle.printStackTrace();
    catch(Exception ex)
    ex.printStackTrace();
    System.out.println("error in finding class "+ex);
    public void doPost(HttpServletRequest Request, HttpServletResponse Response)
                    throws ServletException, IOException {
    public String getServletInfo()
        return "A Simple Servlet";
    }what is the psooible mistake , I use SQL2000.
    Thank you

Maybe you are looking for

  • Operation in Select Statement

    Hi, In an ABAP select statement, how to do operations on two columns of a dictionary transparent table(say division or multiplication on two column values) ? Reward points will be awarded . TIA Regards, Anindita

  • Use 2 function in 1 func

    i want to create zfunction that include 2 standard fuction that will work 1 after another what's the code? thanks.

  • New functions missing in Adobe CC

    Hi I noticed that the new functions such as QR code creator and new document preview in Adobe CC Indesign is missing in my version of CC Indesign. In Dreamweaver I've got the palette CSS Styles but in the new version of Dreamweaver this palette is ca

  • EIGRP issue on 4006L3 and 2621 Rtr

    I added a new network off a 4006L3 switch by creating one of the fastethernet ports as a routed port (using no switchport command on the int). I have created an intermediate network between this FaEth and fa0/1 on the 2621 rtr. EIGRP has been configu

  • My option to delete a song is grayed out and I can't use keyboard to delete

    Can somebody tell me how to delete a song when the option is grayed out on my pull down menu and the delete button on my keyboard isn't the answer either?