4

I have a Play app with db=mem in my application.conf file, and I want to be able to set the database's collation to French, with strength set to primary. Any idea how to do this?

If I add

db.url=jdbc:h2:mem:play;

to my application.conf file, it runs, but using the wrong collation. If I change it to

db.url=jdbc:h2:mem:play;COLLATION=FRENCH;

as per instructions here: h2 Changing Other Settings when Opening a Connection. It breaks, giving the following error:

A database error occured : Cannot connected to the database, URL format error; must be "jdbc:h2:{ {.|mem:}[name] | [file:]fileName | {tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value...]" but is "jdbc:h2:mem:play" [90046-149]

So it looks like COLLATION isn't a supported parameter.

What is the proper way to set the db sort order in Play?

DaveS
  • 3,156
  • 1
  • 21
  • 31

2 Answers2

3

Sorry to answer my own question, but I got it working thanks to this question: Can I have H2 autocreate a schema in an in-memory database?.

The line that works for me is

db.url=jdbc:h2:mem:play;INIT=SET COLLATION FRENCH STRENGTH PRIMARY
Community
  • 1
  • 1
DaveS
  • 3,156
  • 1
  • 21
  • 31
1

The problem is the trailing semicolon (the one at the very end). This works:

jdbc:h2:mem:play;COLLATION=FRENCH

this doesnt:

jdbc:h2:mem:play;COLLATION=FRENCH;
Thomas Mueller
  • 48,905
  • 14
  • 116
  • 132