The following gives some hints for creating a HSQL database and populate it with EPSG data from the SQL scripts.
Copy the sqltool.rc
file in the developper's
home directory and edit it URL path provided in this file.
Prepare a copy of EPSG's SQL scripts and modify them for HSQL syntax. The following Ant file can be used for this purpose.
Creates the database using the following commands:
java org.hsqldb.util.SqlTool --autoCommit EPSG-admin EPSG_v67.hsql_Tables.sql java org.hsqldb.util.SqlTool --autoCommit EPSG-admin EPSG_v67.hsql_Data.sql java org.hsqldb.util.SqlTool --autoCommit EPSG-admin EPSG_v67.hsql_FKeys.sql
Launch the following application:
java org.hsqldb.util.DatabaseManagerSwing
Make sure the database is okay, and invoke the following commands:
SCRIPT 'EPSG.sql'; SHUTDOWN COMPACT;
Quit the application. Edit the EPSG.sql
script as below:
SET DELAY 60
statement; 60 is already the default.CREATE USER "SA"
statement; this user will exists
before the script is run.EPSG_DATUM
, change the type of column REALIZATION_EPOCH
to INTEGER
.ALTER TABLE ... FOREIGN KEY
statements to the end of the script.CONSTRAINT ... FOREIGN KEY
from the CREATE TABLE
statements at the begining of the script, and move them as ALTER TABLE ... FOREIGN KEY
statements at the end of the script.SHUTDOWN COMPACT
statement at the end of file.Run the following commands:
java org.geotools.referencing.factory.epsg.Compactor
Copy the file created in the above step into the
org.geotools.referencing.factory.epsg
package directory
using "EPSG.sql
" filename. Finally, create the JAR file
as usual, which should includes the EPSG.sql
script.