This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Problems with accents in Java+Derby (Netbeans) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problems with accents in Java+Derby (Netbeans)" Watch "Problems with accents in Java+Derby (Netbeans)" New topic
Author

Problems with accents in Java+Derby (Netbeans)

Marvin Legend
Ranch Hand

Joined: Oct 18, 2013
Posts: 35
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

Joined: Sep 02, 2008
Posts: 36

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:


T.A. Nguyen
http://ta.cnci.org
http://www.linkedin.com/in/nguyenta
 
Consider Paul's rocket mass heater.
 
subject: Problems with accents in Java+Derby (Netbeans)
 
Similar Threads
Derby DB not connecting when deployed as an executable jar
Derby database in JDBC
IDE or bust?
Problems with SQL to ignore case in Java + Derby
Questions about learning java from no experience what so ever.