blueless,
What I have done is modify the key value to have %key% instead of trying to modify the 
SQLStatement itself.
It has worked for me. So the statement itself has (select ...... like ?);
--
Jay H. Lang
Chief Technologist
Distributed Computing Professionals Inc.
IBM Certified Specialist - MQSeries
303 277-1873 - Office
303 807-9700 - Cell

blueless wrote:

> hi ....
> I hava problem using jdbc with SQL.
>
> I would like to use "LIKE" statement and preparedStatement for querying data.. and 
>speed...
>
> But when I try it it goes an error...
>
> Except using simple Statement , can I do it successful wih preparedStatement and 
>"LIKE" statement?...
>
> TIA
>
> 1 - sql = "select zipcodeno, sido, gugun, dong, note1, note2  from zipcode where 
>dong like '%" + key + "%'  " ;
> 2 -   sql = "select zipcodeno, sido, gugun, dong, note1, note2  from zipcode where 
>dong  = ? " ;
>   PreparedStatement pstmt = null;
>   pstmt = conn.prepareStatement(sql);
>   pstmt.setString(1,key.trim() );
>
>   ResultSet rs = pstmt.executeQuery();
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to