N
N
Nikita Badyl2016-06-21 20:38:57
MySQL
Nikita Badyl, 2016-06-21 20:38:57

Why are the columns not being created?

Tell me the error in the code, creates a database, creates a table, but does not create columns in the table.

public static void createDB(String url,String nameDB ,String nameUser,String password){
    DB db = new DB(url,"",nameUser,password);
    try{
      db.update("CREATE DATABASE " + nameDB);
      db.update("USE " + nameDB);
      db.update("CREATE TABLE users(id_user INT AUTO_INCREMENT,"
          + "fio VARCHAR(255) NOT NULL,"
          + "login VARCHAR(10) NOT NULL,"
          + "password VARCHAR(10) NOT NULL,"
          + "PRIMARY KEY (id_user))");

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2016-06-21
@dimonchik2013

not columns, but fields take www.mysqlfront.de
or some kind of DB Forge, test the query, then divide it into your own rows for gluing

K
Konstantin Malyarov, 2016-06-21
@Konstantin18ko

Try creating fields and records directly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question