Hi, meine Datenbank ist in "utf8 - default_collation".
wenn ich nun folgendes ausführe:
bekomme ich als Ausgabe:
wenn ich eine int spalte nehme gehts. Problem liegt dabei, dass ich mit "WHERE Spalte=A" kein Ergebniss bekomme obwohl die Spalte als Inhalt "A" hat, halt nur in utf-8 gespeichert.
Wisst ihr wie das zu beheben geht? (brauche utf-8)
wenn ich nun folgendes ausführe:
Java:
String sqlCommand = "SELECT Spalte FROM Tabelle";
ResultSet rs = stmt.executeQuery(sqlCommand);
rs.next();
String inhalt = rs.getString("Spalte");
System.out.println(inhalt);
stmt.close();
sqlCommand="UPDATE Tabelle SET andererInhalt = 42 WHERE Spalte="+inhalt;
stmt = (Statement) conn.createStatement();
stmt.execute(sqlCommand);
stmt.close();
Code:
A
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'A' in 'where clause'
Wisst ihr wie das zu beheben geht? (brauche utf-8)
Zuletzt bearbeitet: