Hmm... one thing I worry about is common typing mistakes when typing in a
database name... although I imagine the create option would be disabled by
default. I do kind of question how generally useful this would be though
outside of a dev environment, most production databases i have seen don't
use an account with administrative privileges for normal geoserver usage.
And I would assume this would only work if the user has access to create
new databases.

Also, one thing to keep in mind is that creating postgis databases with
templates is no longer the recommended way to do this, instead the
extension mechanism is used. So I guess some sort of "initialization" sql
would be needed in that case.




On Tue, Dec 10, 2013 at 7:24 AM, Andrea Aime
<[email protected]>wrote:

> Hi,
> I'm looking into a case where we'd like to automate the very creation
> of a PostGIS database from the GeoTools code, while connecting to it.
>
> Seems a bit of a conundrum, but it's something that is actually possible
> and
> has been discussed at large on the net:
>
> https://www.google.com/search?q=jdbc+postgresql+create+database&oq=jdbc+postgresql+create+database
>
> The idea is that:
> * you connect first to template1 (guaranteed to exist)
> * check if the database is already there
> * if not, create it
> Or alternatively:
> * try to connect
> * if it fails, connect to template1 and create
>
> Now, I guess this would require two new connection params
> * create db if missing
> * template database to use for the creation
> * maybe encoding?
>
> The full list of parameters taken by create database is here:
> http://www.postgresql.org/docs/9.1/static/sql-createdatabase.html
>
> Or maybe, even better, have a single parameter for extras in the create
> dababase,
> and the admin can write something like "TEMPLATE pg2 ENCODING utf-8".
> It could be named CREATE_PARAMS or something like that (I know there is
> someone
> out there good at names that wants to provide a better one :-p )
>
> These new params should probably be marked as "advanced" in the level
> attribute,
> so that auto-generated GUIs can keep them in a separate section.
>
> Opinions?
>
> Cheers
> Andrea
>
> --
> ==
> Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
> information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39  339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>


-- 
*Justin Deoliveira*
Vice President, Engineering | Boundless
[email protected]
@j_deolive <https://twitter.com/j_deolive>
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to