Hi Rob,
this is not an PreparedStatement issue, it's a bad thing in MS ODBC driver
(MS, as usual...:-) ). Just change the asterisk sign to percento sign:
PreparedStatement pstmt = con.prepareStatement("select * from jobserve
where location like ?");
pstmt.setString(1,"%London%");
Hope this helps.
--jerry
P.S.: I know that when you try to run such SQL command from within Access
you should use '*', otherwise it will return zero rows, but in your code
you should use '%'. It's another MS magic...
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Robert Nicholson
Sent: Friday, June 16, 2000 8:18 AM
To: [EMAIL PROTECTED]
Subject: Access , JDBC-ODBC bridge and quoting.
Firstly, can I use prepared statements with access?
I'm trying to add a qualifier.
How do you backquote a " if you want the query
from this
ResultSet rs = stmt.executeQuery("select * from jobserve where location");
to
select * from jobserve where location like "*Amsterdam*"
I tried using a preparedstatement but it did not work.
The following returns zero rows.
PreparedStatement pstmt = con.prepareStatement("select * from jobserve
where
location like ?");
pstmt.setString(1,"*London*");
If I just use "London" I don't get all those containing "London" just the
ones with "London" only.
...
Can you use preparedStatements with like qualifiers?
If not, how do you specify this via jdbc to access?
I've tried
ResultSet rs = stmt.executeQuery("select * from jobserve where location
like
\"*London*\"");
and so forth.
==========================================================================
=
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
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".
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