Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

JDBC Default charset (no replies)

$
0
0
Hi, I would like to know what's the best way to make the JDBC driver work with UTF8 strings as needed?

When I do:
pStmt.setString(1, myString);
it doesn't insert correct unicode characters in db (the charset and collation are correct there)

I have to use this:
pStmt.setBytes(1, myString.getBytes("utf8"));

and that's inconvenient, is there any parameters for JDBC URL, or some settings in connection, etc, to make setString work normally with UTF8 strings?

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>