public class Jdbc01 (
public static final String JDBC_URL="jdbc:mysq1://localhost;3306/?useUnicodem
truescharacterEncoding-utf-8&serverTimezone-urC&allowMultiQueries-true”;
public static final String JDBC USER-"root";
public static final string JDBC_PASSWORD="123456"; public static void main(String[l args) {
Connection con-null;
Preparedstatement ps=null; try {
Class.forName("com.mysql.cj.jdbc.Driver");
con= DriverManager.getConnection(JDBC_URL,JDBC_USER, JDBC_PASSWORD); ps=con.preparestatement("create database chapo4"); ps.executeUpdate();
System.out.println("数据库创建完成..");} catch (Exception e){
e.printstackTrace();}finally {
if(ps!=null){
try {
ps.close();
} catch (SQLException e) {
e.printstackTrace();
if(con!=null){
try {
con.close();
} catch (SQLException e) {
e.printstackTrace();