This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes using Strings to query database?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "using Strings to query database??" Watch "using Strings to query database??" New topic

using Strings to query database??

Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
I have a simple question. Do I have to trim() the strings before using it in a select statement?
for example:
String thisString = request.getParameter("some");
thisString = thisString.trim();
or is it irrelevant??

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
Yes we can do trim function before select
statement.This is very useful code also why because of not all database are not supported to trim function proprty.
I agree. Here's the link:
subject: using Strings to query database??
It's not a secret anymore!