As in the header: I, of course, debugged my application, and therefore in the line where I put the lines in the PreparedStatement variable, the special characters change to "?". Actually, I donβt know where to look for things that should fix it, so I donβt know if the code is needed .. In any case, I will add some of them:
PreparedStatement stm = null; String sql = ""; try{ sql = "INSERT INTO methods (name, description) VALUES (?, ?)"; stm = connection.prepareStatement(sql); stm.setString(1, method.getName()); stm.setString(2, method.getDescription());
while debugging the name field was correct in the method object, but after adding it to the stm variable, it changed the characters to "?".
I found one topic about a similar sitoatuin on SO, but there was no answer that could help me, since I know for sure that there is something wrong when you add a line to the statement and not to the database. But I do not know what ..
Any sugestions?
PS. I am using netbeans version 6.7.1
EDIT: I debugged the standard netbeans debugger and checked the state of the variables before adding lines to the stm variable. I even changed the getName () method to a static string with special characters. So, everything is fine with the Method class.
EDIT2: I did another test. The stm variable to be checked and one of its properties is "charEncoding", which is set to "cp1252". So, the main question: how to change this?
source share