setting connection character set
Posted by: tvrtko stosic
Date: December 04, 2005 07:21AM

How to set connection character set when sending query from java program to MySQL database.

I tried this:


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.

Options: ReplyQuote


Subject
Views
Written By
Posted
setting connection character set
3174
December 04, 2005 07:21AM
8085
February 20, 2006 07:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.