bug in jsp
Hi,
i wrote one oracle query that will execute successfully.
problem is,when i use that same query in jsp it gives an error:
java.sql.SQLException: Column not found
jsp code:<%@ page
import = "java.io.*"
import = "java.lang.*"
import = "java.sql.*"
%>
<%
Connection con;
PreparedStatement st;
ResultSet rs;
String SECNAME,SCNO,NAME,PHASE,METER_NUM,METER_STATUS,
DISTRIBUTION_CODE,CONTLOAD,CATEGORY,FINAL_CLS_BAL, MONTH_STATUS;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:cat","a pcpdclpro3","apcpdclpro3");
String query="Select secname,distribution_code,SCNO,Name,PHASE,CONTLOAD ,CATEGORY,METER_STATUS,FINAL_CLS_BAL,month_status from MAIN_PROFILE_0404 where class='F' and meter_status in('01','04','07','1','4','7') and category NOT IN ('5','6') and SUBDIV_CODE='ADONI' and secname='AE/D2' and REC_FLAG LIKE '%' and REV_FLAG LIKE '%' and AVG_CONS_FLAG LIKE '%' and CONT_LOAD_FLAG LIKE '%' and CATEGORY LIKE '%' ";
st=con.prepareStatement(query);
rs=st.executeQuery( );
if(rs!=null) {
out.println("<table border=2>");
out.println("<tr><th WIDTH=\"4%\">SECNAME</th><th WIDTH=\"3%\">SCNO</th><th WIDTH=\"5%\">NAME</th><th WIDTH=\"3%\">METER_NUM</th><th WIDTH=\"5%\" >METER_STATUS</th><th WIDTH=\"2%\" >CATEGORY</th></tr><th WIDTH=\"2%\" >CONTLOAD</th></tr><th WIDTH=\"2%\" >DISTRIBUTION_CODE</th><th WIDTH=\"2%\" >PHASE</th><th WIDTH=\"2%\" >MONTH_STATUS</th><th WIDTH=\"6%\" >FINAL_CLS_BAL</th></tr>");
while(rs.next( )) {
SECNAME = rs.getString("secname");
SCNO=rs.getString("SCNO");
NAME = rs.getString("NAME");
METER_NUM =rs.getString("Meter_Num");
METER_STATUS=rs.getString("METER_STATUS");
CATEGORY=rs.getString("CATEGORY");
CONTLOAD=rs.getString("CONTLOAD");
DISTRIBUTION_CODE=rs.getString("distribution_code" );
PHASE = rs.getString("PHASE");
FINAL_CLS_BAL=rs.getString("FINAL_CLS_BAL");
MONTH_STATUS=rs.getString("month_status");
out.println("<tr><td>" +SECNAME);
out.println("<td>" + NAME);
out.println("<td>" +SCNO);
out.println("<td>" + METER_NUM);
out.println("<td>" + METER_STATUS);
out.println("<td>" + CATEGORY);
out.println("<td>" + CONTLOAD);
out.println("<td>" + DISTRIBUTION_CODE);
out.println("<td>" + PHASE);
out.println("<td>" + FINAL_CLS_BAL);
out.println("<td>" + MONTH_STATUS);
}
out.println("</tr></table>");
}else {
out.println("no rows selected with this selection...");
}
st.close( );
rs.close( ) ;
}
catch(Exception e) {
out.println("Exception..."+e);
}
%>
_________
sagar
|