Changing character set to latin1

184 views
Skip to first unread message

vani

unread,
Nov 14, 2011, 2:33:41 AM11/14/11
to H2 Database
Is there is any way to change the default character set to latin1.

When I am trying to execute the below query

CREATE TABLE `messageTypeColor` (
`userId` INT NOT NULL,
`messageType` VARCHAR(45) CHARACTER SET latin1 COLLATE latin1_bin
NOT NULL,
`foreground` VARCHAR(45) NOT NULL,
`background` VARCHAR(45) NOT NULL,
PRIMARY KEY (`userId`, `messageType`),
CONSTRAINT `fk_userid_messagetypecolor` FOREIGN KEY (`userId`)
REFERENCES `user` (`userId`)
ON DELETE CASCADE
) ;

I am getting the error as below


ERROR: Syntax error in SQL statement "CREATE TABLE
""MESSAGETYPECOLOR""
(
""USERID"" INT NOT NULL,
""MESSAGETYPE"" VARCHAR(45)
CHARACTER[*] SET LATIN1 COLLATE LATIN1_BIN NOT NULL,

""FOREGROUND"" VARCHAR(45) NOT NULL,
""BACKGROUND"" VARCHAR(45)
NOT NULL,
PRIMARY KEY (""USERID"", ""MESSAGETYPE""),

CONSTRAINT ""FK_USERID_MESSAGETYPECOLOR"" FOREIGN KEY
(""USERID"")
REFERENCES ""USER"" (""USERID"")
ON DELETE
CASCADE
) ; "; expected ")"; SQL statement:

Thomas Mueller

unread,
Nov 17, 2011, 2:15:51 AM11/17/11
to h2-da...@googlegroups.com
Hi,

H2 supports Unicode, there is no need to set the character set. You can't set it.

You can set the collation however (only per database): http://h2database.com/html/grammar.html#set_collation

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages