import java.sql.*;
public class Test {
public static void main(String[] srg) {
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
//加载JDBC驱动
String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=master";
//连接服务器和数据库master
String userName = ...
创建
create database student
go
学生表
create table student
(
stu_name varchar(30) not null,
stu_id char primary key (stu_id),
stu_specialty varchar(30) not null,
stu_sex char(2) check( stu_sex in (‘男’,’女’)),
stu_age int check (stu_age>16)
)
课程表
create table studentclass
...