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

Reply via email to