Subject Re: [Firebird-Java] Creating unique column entries
Author Roman Rokytskyy
> I'm not sure this is even a Jaybird question. I'm using Firebird 1.5
> on Windows. I created a talble like this:
>
> CREATE TABLE Vehicle
> (
> Id char(10),
> Name varchar(32) NOT NULL unique,
> CONSTRAINT PK_Vehicle PRIMARY KEY (Id)
> );
>
> I want to make sure that no two vehicles have the same name.
> However, the followin does not cause an exception:
>
> statement.execute("insert into vehicle values('1', 'Foo')");
> statement.execute("insert into vehicle values('2', 'Foo')");
>
> Any ideas why?

As far as I remember, constraints are evaluated on commit. So, if you set
auto-commit to false, you will get exception only when you commit data. Is
it your case?

Roman