Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with accents in Java+Derby (Netbeans)

 
Marvin Legend
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys, I have a problem in Java + DerbySQL, I'm having trouble with accents, because when I search for a word that has accent, do not get results. I did a debug the code and noticed that the java (NetBeans IDE) puts in place the letter with the accent question mark (?) And at query time he seeks the word with this question in a word, or where the accent exists in my code is a string variable that receives the data entered by the user, and this variable is set in the SQL search string (example: ), I'm using the Derby database, I did the same search words with accents and worked properly at the derby console, inside the tab" Services "NetBeans, so I think the problem is in java, how to String variable P1 recognize accents and properly send the quest for the Derby? How can I solve this?
 
T.A. Nguyen
Ranch Hand
Posts: 36
Eclipse IDE Java ME Oracle
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marvin Legend wrote:
...


You should be using a PreparedStatement and let the jdbc statement do all the escaping for you. This is also prevent SQL injection too. And your code should be:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic