Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting connection character

Status
Not open for further replies.

tvrtko

Programmer
Nov 26, 2003
53
HR
How to set connection character set when sending query from java program to MySQL database.

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top