连接mysql
try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } try { con = DriverManager .getConnection( "jdbc:mysql://192.168.151.241:3306/cehua?useUnicode=true&characterEncoding=UTF-8", "bokong", "vcomvcom"); } catch (SQLException e) { e.printStackTrace(); }
useUnicode=true&characterEncoding=UTF-8 用来防止中文乱码