This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
i have a strange problem when i am searching with my data base o a column by using java.
My problem is i am using a search which has one field t search like "starts with" or "ends with" or "contains" of a word i am getting user values in a servlet and and building a query based on that my query is
upto now it's fine. i executed this querying my database it is giving 1 record but in my java program it is giving no record why?
My Java code is
k there is nothing wrong with my query generation. some stupid guy entered space after the word so the search is getting failed. but in my sql when execute same query it is automatically trimming space at the end showing result why?
mallikarjun dontamsetti wrote:k there is nothing wrong with my query generation. some stupid guy entered space after the word so the search is getting failed. but in my sql when execute same query it is automatically trimming space at the end showing result why?
find out how your databases does right trim and do that on the column in the select.
mallikarjun dontamsetti wrote:k there is nothing wrong with my query generation. some stupid guy entered space after the word so the search is getting failed. but in my sql when execute same query it is automatically trimming space at the end showing result why?
have you learnt all of this information since the 1st post, as I find the tone of this message actually quite rude.
You showed us half a snippet of code, said it wasn't returning rows.
As to why your browser is ignoring trailing spaces, how the hell are we supposed to know.
mallikarjun dontamsetti wrote:... but in my sql when execute same query it is automatically trimming space at the end showing result why?
Depends how you are viewing the query results. If you are viewing them via a web browser, it may be that the browser is seeing the output values as normal HTML strings and collapsing the whitespace. And you should probably be stripping trailing spaces from your input values instead of relying on the user to get it right. Garbage in, garbage out.
In general, you should write and test your SQL directly on the database e.g. via your DB's SQL shell or using a proper DB tool (TOAD, SQLDeveloper etc).