aspose file tools*
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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to use apostraphe in select statement" Watch "how to use apostraphe in select statement" New topic
Author

how to use apostraphe in select statement

ranga shreya
Greenhorn

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
Rancher

Joined: Mar 06, 2001
Posts: 13459

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

Joined: May 26, 2003
Posts: 31057
    
232

Ranga,
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: http://aspose.com/file-tools
 
subject: how to use apostraphe in select statement