How to do multiple commands one execute in the HSQ

2019-07-11 07:24发布

I have a number of command that I want to do from the GUI. I want to do many groups of these, but I can't get a single group to work. I presume I need to somehow force commits between them, but I can't figure out how to do that. If I execute each one of these commands by itself in order, everything works as expected.

I'm using the EPSG.dat from GeoTools' EPSG.zip.

unzip EPSG.zip
perl -pi -e 's/readonly=true/readonly=false/' EPSG.properties

java -jar hsqldb-2.4.1.jar
jdbc:hsqldb:file:./EPSG

SET AUTOCOMMIT true;  -- Press Execute SQL, but this doesn't seem to help.

CREATE TEXT TABLE EPSG_UNITOFMEASURE_COPY (LIKE EPSG_UNITOFMEASURE);                                                      
GRANT all ON  EPSG_UNITOFMEASURE_COPY TO public;                                                                          
SET TABLE EPSG_UNITOFMEASURE_COPY SOURCE 'EPSG_UNITOFMEASURE_COPY.csv;encoding=UTF-8';                                    
INSERT INTO EPSG_UNITOFMEASURE_COPY SELECT * FROM EPSG_UNITOFMEASURE;                                                     
SET TABLE EPSG_UNITOFMEASURE_COPY SOURCE OFF;                                                                             

I then get an error of:

user lacks privilege or object not found: EPSG_UNITOFMEASURE_COPY / Error Code: -5501 / State: 42501

I am pretty sure this is an object not found case.

标签: sql hsqldb
1条回答
趁早两清
2楼-- · 2019-07-11 07:49

You cannot execute these commands as one block. When a schema definition statement refers to a schema object, that object must already exist.

Execute the CREATE TEXT TABLE, then you can execute the rest as a block.

查看更多
登录 后发表回答