Retrieve value from as400 though jsp

  • Follow


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

0
Reply savita.raskar (11) 3/24/2007 4:53:19 AM


0 Replies
102 Views

(page loaded in 0.042 seconds)

Similiar Articles:













7/28/2012 2:12:10 PM


Reply: