Hi Martin,

many many thanks for the detail description. This makes it much clearer now for 
me.

I have some follow up questions.

What happens (for some reason) the db is not available anymore.
Is there an exception I can catch to handle something like this?
Is there a method in SIS that I can use to verify that the DataSource has been 
set up correctly?

Also thanks for the hint with the index [1]. I see there is also a prepare.sql 
script [2]. 
Is this also necessary or what is its purpose?

Greetings
Florian

[1] 
https://github.com/apache/sis/blob/master/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG_Finish.sql

[2] 
https://github.com/apache/sis/blob/master/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql

Am Sonntag, dem 30.10.2022 um 00:44 +0200 schrieb Martin Desruisseaux:
> 
>       Hello Florian<br>
>       
> The following line:<br>
>       
> 
> >         ```
> Configuration.current().setDatabase((Supplier<DataSource>) 
> createDataSource());
> > ```
> 
> >       
> 
>       Should be replaced by:<br>
>       
> 
> >         ```
> Configuration.current().setDatabase(MyJavaApp::createDataSource);```
> 
> >       
> 
>       Where MyJavaApp is the class
>         where is defined the createDataSource()
>         static method. Everything else should be fine.<br>
>       
> With this setting, MyJavaApp.createDataSource()
>         will be invoked by SIS exactly once the first time that an EPSG
>         code is used. Then the DataSource.getConnection()
>         method will invoked (by SIS again) for getting the connection.
>         The connection will be used and closed after a short timeout.
>         There is no need to open and close connections on your side.<br>
>       
> The first time that a connection is established, SIS will
>         search for EPSG tables in all database schemas and will remember
>         in which schema the tables were found. So it is okay to put the
>         EPSG tables in any schema (not necessarily "public"). On my side I 
> like to create
>         a separated "epsg" schema for
>         those tables.<br>
>       
> If there is many copies of EPSG dataset in different schemas,
>         SIS checks the EPSG dataset version number and use by default
>         the most recent EPSG dataset. It is possible to request to use
>         of a specific version of EPSG dataset by specifying the version
>         number before EPSG code, for example "EPSG:9.0:4326".<br>
>       
> One last note: the SQL scripts provided by EPSG do not include
>         the creation of index. For better performances, you may want to
>         also execute the following file in SIS repository:<br>
>       
> 
> >         ```
> core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG_Finish.sql
> > ```
> 
> >       
> 
>           Martin<br>
>       
> <br>
>       <br>
>     <br>

Reply via email to