Harry, Yes the ClassifiedAd and UniqueDateId are two parameters taken from an html form, the values of ClassifiedAd and UniqueDateId are used in a prepared statement for substitution of ? and ? the results are then forwarded to a results jsp, which used the getXXX() to retrieve the values from the bean. I have this code working in another form as a Servlet using JNDI and prepared statements. In the servlet the JNDI connection is made in the init(blah, blah) and calls the super.init(config) which I super.init(config) is implicit from reading the Tomcat docs. The bottom line on this, is how do you set up a JNDI connection in a bean, use a prepared statement (in a bean), retrieve a resultset and forward the result for the results jsp to retrieve the value from the bean.
Finally, I apologize to those who feel this is off topic. I have similar code working in Resin but for the life of me, I can't get it working with Tomcat 5 :-( I searched all the archives and can't find a good example for doing this. TIA Tom K. -----Original Message----- From: Harry Mantheakis [mailto:[EMAIL PROTECTED] Sent: Friday, March 26, 2004 2:29 AM To: Tomcat Users List Subject: Re: Question on debuggin JNDI/prepared statement in a bean Hello > pstmt.setString(1,ClassifiedAd); > pstmt.setString(2,UniqueDateId); Are those two parameters - 'ClassifiedAd' and 'UniqueDateId' - variables? They should be, and if so, where do you declare and initialise them? They do not appear in the method you posted. Harry > I am frustrated trying to debug a prepared statement within a bean; what > am I doing wrong?; ANY clues appreciatedŠ > It is not throwing any exceptions yet I methodically went over the code; > granted this is the first time I used beans versus servlets. > > Can anyone point me to a good example (JNDI, JSP, JavaBean, Resultset) > > Code within bean: > > private void prepareStatement(){ > try{ > > Context env = (Context) new > InitialContext().lookup("java:comp/env"); > pool = (DataSource) env.lookup("jdbc/myDB"); > > if (pool == null) > throw new NamingException("`jdbc/ myDB ' is an > unknown DataSource"); > > > > //dbConnection = null; > dbConnection = pool.getConnection(); > > > String SQLCmd = > "select * from AdInfoView where Classification = ? > " > + "and UniqueDateId < ? order by UniqueDateId > desc"; > > pstmt = dbConnection.prepareStatement(SQLCmd); > // TEST Exception thrown here. > // pstmt.setString(1,searchWord); > pstmt.setString(1,ClassifiedAd); > pstmt.setString(2,UniqueDateId); > > }catch(Exception e){ > System.err.println("Problem preparing statement " + > e.getMessage() + e.getCause()); > } > } > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003 > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]