Create autoincrement key in Java DB using NetBeans IDE

umpirsky picture umpirsky · Jul 22, 2010 · Viewed 121k times · Source

I'm coming from MySQL world, please help.

Is it possible to create autoincrement key from NetBeans IDE in JavaDB?

Do you use some more advanced db clients, which?

Thanks.

Answer

Sam picture Sam · Nov 18, 2010

This may help you:

CREATE TABLE "custinf"

(    
   "CUST_ID" INT not null primary key
        GENERATED ALWAYS AS IDENTITY
        (START WITH 1, INCREMENT BY 1),   
   "FNAME" VARCHAR(50),     
   "LNAME" VARCHAR(50),
   "ADDR" VARCHAR(100),
   "SUBURB" VARCHAR(20),
   "PCODE" INTEGER,  
   "PHONE" INTEGER,
   "MOB" INTEGER,    
   "EMAIL" VARCHAR(100),
   "COMM" VARCHAR(450)    
);

That's how i got mine to work... to ages to get the frigging thing to actually understand me but that's the nature of code :D

BTW!- There is a way to do it in the ide interface goto the services window, expand your connection, expand your projects name, expand tables, right click indexes and select add index... the rest of the process speaks for itself really...