Retrieve value from as400 though jsp

Discussion in 'Java' started by savita, Mar 24, 2007.

  1. savita

    savita Guest

    Hello All,

    I am new to jsp.

    I have table F0006LZ in as400.This table has column MCMCU , which
    contains following values

    MCMCU

    M1
    92821
    92822
    92823
    92824
    92825
    92826
    92827
    92828
    92829
    92830


    COde written in jsp as follows:


    Class.forName("com.ibm.as400.access.AS400JDBCDriver")
    Connection
    conn=DriverManager.getConnection("jdbc:as400:192.168.0.10","xxx","xxx");
    PreparedStatement stat=conn.prepareStatement("SELECT MCMCU FROM
    HTPL.F0006LZ");
    ResultSet rs=stat.executeQuery();
    if(rs.next())
    {
    out.println(rs.getString("MCMCU"));
    }



    On the webpage I am getting the output
    40404040404040404040D4F1

    If I write the following code rs.getInt("MCMCU");

    if(rs.next())
    {
    out.println(rs.getInt("MCMCU"));
    }

    The output is
    Errorjava.sql.SQLException: Data type mismatch.

    How do I access value from the COlumn MCMCU which consists of
    character and integer value?
    I new to as400, I do not know the column index of MCMCU

    The query SELECT MCMCU FROM HTPL.F0006LZ works in as400.

    Thanks
    savita, Mar 24, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RC5TYXJhdmFuYW4=?=

    DB_E_BADPROPERTYVALUE error when connecting to AS400 db2 udb

    =?Utf-8?B?RC5TYXJhdmFuYW4=?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    467
    =?Utf-8?B?RC5TYXJhdmFuYW4=?=
    Jun 18, 2004
  2. Manuel Arroba
    Replies:
    0
    Views:
    2,042
    Manuel Arroba
    Jun 28, 2004
  3. Cor Ligthert

    Re: AS400 And ADOx

    Cor Ligthert, Sep 14, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    587
    Cor Ligthert
    Sep 14, 2004
  4. kh
    Replies:
    2
    Views:
    17,396
    bruce barker
    Nov 23, 2004
  5. Jsp and AS400

    , Mar 17, 2007, in forum: Java
    Replies:
    0
    Views:
    812
Loading...

Share This Page