This topic doesn't really have anything to do with Tomcat so you might have
better luck receiving help on some other mailing list.  Anybody know which
list he should be posting to?

What is the actual problem you are having?

Do you execute your prepared statement somewhere?

Adrian


----- Original Message ----- 
From: "Harry Mantheakis" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, March 26, 2004 3:28 AM
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 appreciatedS
> 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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to