I have a table named "statuses" in my MySQL database which looks like this:
| "id" (int) | "text" varchar(50) | "hex_color" varchar(10) |
-------------------------------------------------------------
| 1 | EJ PÅBÖRJAD | #FF3300 |
| 2 | ARBETE PÅGÅR | #FFFF00 |
| 3 | AVVAKTAR | #80F0FF |
| 4 | ÅTGÄRDAD | #6DE37A |
-------------------------------------------------------------
Here's my JDBC Java-code:
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(statement);
while(rs.next()){
Long pid = rs.getLong(1);
String ptext = rs.getString(2);
String hex_color = rs.getString(3);
status = new Statuses(pid, ptext, hex_color);
}
When statement is:
SELECT id, text, hex_color FROM statuses WHERE text = 'EJ PÅBÖRJAD' - 1 result
SELECT id, text, hex_color FROM statuses WHERE text = 'ARBETE PÅGÅR' - 0 result
SELECT id, text, hex_color FROM statuses WHERE text = 'AVVAKTAR' - 1 result
SELECT id, text, hex_color FROM statuses WHERE text = 'ÅTGÄRDAD' - 1 result
why do i get 0 result on the second statement? when i'm running it myself in "mysql command line" i get 1 result! i've checked that i'm using the same charset (UTF-8) which rules out charset problem.
can someone please help me on this matter?
kind regards, Clyde
SELECT id, text, hex_color FROM statuses WHERE text = 'ARBETE PÅGÅR'before it executes