Retrieve value from as400 though jsp

S

savita

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top