jdbc数据库的基础用法

用jdbc建表user_info
id-------唯一标识符
uname-----用户
pwd-------密码
phone-----手机号
gender----性别

创建序列:user_info_seq 从100开始
用Scanner类型模拟用户注册

用户名存在,不能注册,
用户名不存在,才可以注册

就是我现在表和序列都写好了,但是怎么通过Scanner类插入数据

 import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public final class MysqlConnectTest
{
    private static String url;
    private static String username;
    private static String password;

    static {
        // 加载MySql的驱动类
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
            url = "jdbc:mysql://localhost:3306/test";
            username = "root";
            password = "WAtm@951.";

        }
        catch (ClassNotFoundException e)
        {
            e.printStackTrace();
            System.exit(0);
        }

    }
    static Connection openConnection() throws SQLException{
        return DriverManager.getConnection(url, username, password);
    }
    static void closeConnection(Statement stmt, Connection con) throws SQLException{
        if(stmt != null) {
            stmt.close();
        }
        if (con != null) {
            con.close();
        }
    }
    public static void main(String[] args) throws SQLException
    {
        Connection con = openConnection();
        Statement stmt = con.createStatement() ;
        int successRows = stmt.executeUpdate("insert into user_info(uname) select 'zhangchao' from user_info where"
                + " not exists(select * from user_info where uname = 'zhangchao')");
        System.out.println(successRows);
        closeConnection(stmt, con);      
    }
}