How to set connection character set when sending query from java program to MySQL database.
I tried this:
but it doesn't work.
It works from MySQL command line client.
I tried this:
Code:
String query = "SET NAMES 'cp1250'"; /* character set */
stmt = conn.prepareStatement(query);
stmt.executeQuery(); /* I also tried stmt.execute(); */
query = "SELECT * FROM myTable";
stmt = conn.prepareStatement(query);
rs = stmt.executeQuery();
but it doesn't work.
It works from MySQL command line client.