Reputation: 9158
In JDBC url you specify the character encoding .
ex:
jdbc:mysql://host:3306/db?characterEncoding=UTF8
.
jdbc:teradata://host/DBS_PORT=1025,DATABASE=Orders,CHARSET=UTF8
I am trying to understand how this actually works.
Does this mean that the client specifically asks the server in which character-encoding it wants data?
If actual data is saved in different character encoding in DB (say Shift_JIS), does the DB server perform the encoding conversion before sending data to the client? (in this example, from SJIS to UTF-8 ?)
Upvotes: 3
Views: 2284
Reputation: 108994
This is not directly related to JDBC, but it is a specific implementation detail for individual JDBC drivers. Not all drivers/databases allow you to specify a connection character set. This could be because their protocol always uses a specific character set, or the encoding is fixed per column and communicated together with the data. And if a driver does have such a property, its effects will vary per driver/database system and maybe even per specific database, table or even column.
It is not really possible to generalize exactly what such a setting does over drivers.
I already find it hard enough to describe the exact effects (and edge cases) of the connection character set for the JDBC driver that I maintain..., let alone consider/investigate that for other drivers.
Upvotes: 3