简体   繁体   中英

Why is my Sql code not working in Derby in java?

I am using eclipse and following http://www.eclipse.org/articles/article.php?file=Article-EclipseDbWebapps/index.html and it all works fine except when I try to run my own sql code. Here it is:

CREATE TABLE honscores (
  idhonscores INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
  Name varchar(25) NOT NULL,
  Characters VARCHAR(25) NOT NULL,
  Kills integer(11) NOT NULL,
  Deaths integer(11) NOT NULL,
  Assists integer(11) NOT NULL,
  XPM integer(11) NOT NULL,
  CK integer(11) NOT NULL);

Any help will be appreciated.

Here is the error message :

Syntax error: Encountered "(" at line 5, column 20.

Elapsed Time: 0 hr, 0 min, 0 sec, 0 ms.

CREATE TABLE app.honscores ( //schema name is before the table name
  idhonscores INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
  Name varchar(25) NOT NULL,
  Characters VARCHAR(25) NOT NULL,
  Kills integer NOT NULL,
  Deaths integer NOT NULL,
  Assists integer NOT NULL,
  XPM integer NOT NULL,
  CK integer NOT NULL
);

Im pretty sure this is how I fixed it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM