package com
.test
;
import java
.sql
.Connection
;
import java
.sql
.DriverManager
;
import java
.sql
.Statement
;
public class Jd {
public static void main(String
[] args
) throws Exception
{
Class
.forName("com.mysql.jdbc.Driver");
String url
= "jdbc:mysql://localhost:3306/jiejie";
Connection conn
= DriverManager
.getConnection(url
, "root", "root");
Statement statement
= conn
.createStatement();
String sql
= "insert into dept values(50,'搞笑部','光环')";
statement
.execute(sql
);
statement
.close();
conn
.close();
}
}
转载请注明原文地址: https://win8.8miu.com/read-9.html