Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [client]
- default-character-set=utf8
- [mysql]
- default-character-set=utf8
- [mysqld]
- collation-server = utf8_unicode_ci
- init-connect='SET NAMES utf8'
- character-set-server = utf8
- static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
- static final String DB_URL = "jdbc:mysql://localhost:3306/andrey3k?useUnicode=true&characterEncoding=UTF-8";
- static final String USER = "root";
- static final String PASS = "luxury1life";
- try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch (ClassNotFoundException e1) {
- e1.printStackTrace();
- }
- try {
- conn = DriverManager.getConnection(DB_URL,USER,PASS);
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
- try {
- stmt = conn.createStatement();
- } catch (SQLException e1) {
- }
- try {
- stmt.executeQuery("SET NAMES 'UTF8'");
- } catch (SQLException e2) {
- e2.printStackTrace();
- }
- try {
- stmt.executeQuery("SET CHARACTER SET 'UTF8'");
- } catch (SQLException e2) {
- e2.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement