23,407
社区成员
发帖
与我相关
我的任务
分享public static void main(String[] args) throws ClassNotFoundException,
SQLException {
// 1.加载驱动
Class.forName("com.mysql.jdbc.Driver");
// 2.建立连接
Connection conn = DriverManager
.getConnection(
// 怎样插入中文??,在mysql中显示乱码捉鸡
"jdbc:mysql://localhost:3306/b1?useUnicode=true&characterEncoding=UTF-8",
"root", "toor");
// 创建Statement
Statement stm = conn.createStatement();
// 发送sql语句
String sql = "insert into t1 value(11,'奥巴马')";