user3414321
user3414321

Reputation: 421

H2 Database fails to find existing column

My Configuration file:

# H2
spring.h2.console.enabled=true
spring.h2.console.path=/h2

# Datasource
spring.datasource.url=jdbc:h2:file:~/test
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver

my data.sql script is something like :

CREATE TABLE IF NOT EXISTS people (
   ID INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
   vname varchar(255) not null
);

INSERT INTO people(vname) VALUES ('Chuck Norris');

When this is executed, INSERT fails with error : cannot find 'VNAME' column.

  1. Why is the column name auto all capsed? does that affect my INSERT command?
  2. I just created the table, why cant INSERT find vname column?

Upvotes: 0

Views: 779

Answers (1)

Per Huss
Per Huss

Reputation: 5105

Did you perhaps already create the table PEOPLE without the VNAME column? Your SQL won't touch it if the table already exists. Remove the database files and try again...

Upvotes: 2

Related Questions