Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hypersonic DB question

 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to follow a tutorial here

Tutorial

Running this script in order to create tables:



However, the ITEM table is not created. It keeps telling me that



What is the meaning of this error? What do I need to change to make it work???

Thanks, I am quite new to this.
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to provide a unique name for your constraint.

You name your constraint SYS_FK_SUPPLIER for table SUPPLIER,
and you also try to create a constraint with the same name for table ITEM.

Try someting like ... CONSTRAINT <TABLENAME>_FK_SUPPLIER.

Regards, Jan
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. What does CONSTRAINT mean?

I could not find anything about it on Google.
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A constraint is a validation mechanism.
It will guard that the data that you write adheres to your rules.

Your constraint CONSTRAINT SYS_STOREACCESS_UQ UNIQUE(USERNAME) will allow only unique values in column USERNAME.
If your table STOREACCESS has a record with USERNAME == 'Joseph Sweet', and you try to insert a new record with USERNAME == 'Joseph Sweet', it will fail.
Also updating another record to set USERNAME == 'Joseph Sweet' will fail.

Your constraint guarantees that USERNAME will only have unique values. No duplicates are allowed.

Regards, Jan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic