jdbc string sql server character encoding

12,666

Solution 1

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).

Solution 2

Did you try, as in Php,

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

Regards, stéphane

Share:
12,666
David
Author by

David

Java Developer with quite a passion for software engineering. Building bits an bobs to make life easier. Github : https://github.com/david99world

Updated on June 27, 2022

Comments

  • David
    David almost 2 years

    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,