Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes how to use apostraphe in select statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to use apostraphe in select statement" Watch "how to use apostraphe in select statement" New topic

how to use apostraphe in select statement

ranga shreya

Joined: Mar 05, 2005
Posts: 20
Hi There,
I am trying to login as different names(newport news,Kohl's,macy's).
With my query I am abel to get my data for "newport news" not for"macy's".
My Question is how to get data if I login as "macy's". What could be the select statement.
Give me some suggessions.

Thanks,<br />Ranga.<br />Life is precious so enjoy the life each moment and utilise it at the same time.
Annie Smith
Ranch Hand

Joined: Mar 05, 2005
Posts: 172
I suppose you need to escape that ' character. Use \\' to pass it in your query.

Cheers!<br /><b>Annie</b>
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Or you can use a PreparedStatement and these problems just... go away
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30057

Welcome to JavaRanch!

I agree with David that you should use Prepared Statements. The Sun tutorial walks you through the details.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: how to use apostraphe in select statement
Similar Threads
What kind of shirt it is?
Cascading Select statements using jQuery
need help on how to extract specific data from access base into java script
from servlet i want to use Ms Access
by click on submit buutton the page refresh a get new data from database