Java examples for java.sql:MySQL
get mysql Connection and set unicode
//package com.java2s; import java.sql.Connection; import java.sql.DriverManager; public class Main { private static final String url = "jdbc:mysql://localhost:3306/jee_lab?useUnicode=true&characterEncoding=UTF-8"; private static final String username = "root"; private static final String password = "123456"; private static Connection conn = null; public static Connection getConnection() throws Exception { if (conn == null) { conn = DriverManager.getConnection(url, username, password); return conn; }/* w w w.j a va2 s. c o m*/ return conn; } }