Play Framework: How to change the sort order of my database?

I have a Play application with db = mem in my application.conf file, and I want to be able to set the database mapping to French, with the force set to primary. Any ideas how to do this?

If I add

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

to the application.conf file, it starts, but using the wrong sort. If I change it to

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

according to the instructions here: h2 Change other settings when opening a connection . It breaks, causing the following error:

Database error occurred: cannot connect to database, URL format error; should be "jdbc: h2: {{. | mem:} [name] | [file:] fileName | {tcp | ssl}: [//] server [: port] [, server2 [: port]] / name} [; key = value ...] "but it is" jdbc: h2: mem: play "[90046-149]

So, it looks like COLLATION is not supported.

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

+4
source share
2 answers

Sorry to answer my own question, but I got it working thanks to this question: Can I run H2 to automatically assemble the circuit in the database in memory? .

The line that works for me is

 db.url=jdbc:h2:mem:play;INIT=SET COLLATION FRENCH STRENGTH PRIMARY 
+3
source

The problem is the end semicolon (the one that is at the very end). It works:

 jdbc:h2:mem:play;COLLATION=FRENCH 

this does not:

 jdbc:h2:mem:play;COLLATION=FRENCH; 
+1
source

Source: https://habr.com/ru/post/1385406/


All Articles