Wrox Programmer Forums
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 5th, 2004, 09:16 AM
Registered User
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sagar
Default 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
ANOTHER Bug - Ch 7 Johnslg BOOK: Expert SQL Server 2005 Integration Services ISBN: 978-0-470-13411-5 1 August 30th, 2007 10:00 AM
Bug or no to bug learning C using VS.Net to compil tesh All Other Wrox Books 0 February 14th, 2007 01:06 PM
Please Help. mr_newreq.jsp:78: jsp:useBean can't f batken JSP Basics 0 February 22nd, 2006 09:56 PM
Bug happens guoqi BOOK: ASP.NET Website Programming Problem-Design-Solution 0 October 13th, 2003 01:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.