David
David

Reputation: 20073

jdbc string sql server character encoding

If I have a jdbc string such as...

jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]

How do you say "connect with character encoding as utf-8 like you can if you were connecting with mysql?

Thanks,

Upvotes: 3

Views: 15407

Answers (2)

Tim Jansen
Tim Jansen

Reputation: 3368

According to the documentation, there is no such property in the URL schema. But you probably don't need it anyway. The JDBC driver will take your strings in Java Unicode and return all values in Java Unicode. In Java it does not matter which character encoding the driver uses for communication with the DB (unless you do something really unusual, like trying to work around database bugs, or your database is not aware of the encoding of its content).

Upvotes: 0

Snicolas
Snicolas

Reputation: 38168

Did you try, as in Php,

jdbc:sqlserver://serverName\instanceName;CharacterSet=UTF-8

Regards, stéphane

Upvotes: 1

Related Questions