//插入
public static void main(String[] args) throws SQLException {
Connection conn = null;
Statement stmt = null;
String JDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
String connectDB="jdbc:sqlserver://localhost:1433;DatabaseName=JDBCTest";
String user="sa";//数据库用户名保存在变量user中
String pwd="sql";//数据库密码保存在变量pwd中
try {
// 动态导入数据库的驱动
Class.forName(JDriver);
// 获取数据库链接
conn = DriverManager.getConnection(connectDB,user,pwd);
// 创造SQL语句
String sql = "INSERT INTO JDBCTestTable ( user_name, user_password ) VALUES ( 'balabala', '123456' )";
// 执行SQL语句
stmt = conn.createStatement();
stmt.executeUpdat
public static void main(String[] args) throws SQLException {
Connection conn = null;
Statement stmt = null;
String JDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
String connectDB="jdbc:sqlserver://localhost:1433;DatabaseName=JDBCTest";
String user="sa";//数据库用户名保存在变量user中
String pwd="sql";//数据库密码保存在变量pwd中
try {
// 动态导入数据库的驱动
Class.forName(JDriver);
// 获取数据库链接
conn = DriverManager.getConnection(connectDB,user,pwd);
// 创造SQL语句
String sql = "INSERT INTO JDBCTestTable ( user_name, user_password ) VALUES ( 'balabala', '123456' )";
// 执行SQL语句
stmt = conn.createStatement();
stmt.executeUpdat