package com.java.development.seventeen_database.exericses;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
/**
*
* @ClassName: Ex01
* @Description: 建立一个用户表(数据表和表中的数据列由用户自行创建),
* 表的名称和列的定义都使用键盘输入,并在数据库之中创建此表。
* @author houdo
* @date 2018年11月18日 上午9:34:52
*
*/
public class Ex01 {
// 定义MySQL的数据库驱动程序
public static final String DBDRIVER = "com.mysql.cj.jdbc.Driver";
// 定义MySQL数据库的连接地址
public static final String DBURL = "jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true";
// MySQL数据库的连接用户名
public static final String DBUSER = "root";
// MySQL数据库的连接密码
public static final String DBPASS = "123456";
public static String sql1 = null;
static Ex01 e1 = new Ex01();
class InputData {// 数据输入类
private BufferedReader buf = null;
public InputData() {
this.buf = new BufferedReader(new InputStreamReader(System.in));
}
public String getString(String info) {// 输入字符串
String temp = null;
System.out.print(info);
try {
temp = buf.readLine();
} catch (IOException ee) {
ee.printStackTrace();
}
return temp;
}
public String getTableString(String info, String err) {// 输入列的名称及类型
String temp = null;
boolean flag = false;
while (flag == false) {
Sys