解决方案 »

  1.   

    很简单啊,用JDBC的executeUpdate()就行,sql语句就写 create table xxx.  xxx就是你前台提交的表名,可以串接到sql串或者用preparedstatement,随你啊。
      

  2.   

    Statement stmt = con.createStatement();stmt.executeUpdate("CREATE TABLE COFFEES " +
        "(COF_NAME VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, " +
        "SALES INTEGER, TOTAL INTEGER)");
      

  3.   

     Class.forName("com.mysql.jdbc.Driver");
                conn=DriverManager.getConnection(URL,USER,PASSWORD);//这里就是连接数据库了
                String sql1 = "CREATE TABLE "+jusername+" (id int not null, danci char(15), shiyi char(30), primary key (id));";             PreparedStatement us = conn.prepareStatement(sql1);
                us.executeUpdate();
    我用了这条语句,但是id它不能自动增加,所以在数据表中我插入不了数据,要加什么语句对id设置自动增加呢
      

  4.   

    create table user (id int primary key AUTO_INCREMENT)