Topic
  • No replies
SystemAdmin
SystemAdmin
9224 Posts

Pinned topic runsql statement cannot find the database

‏2011-07-26T20:12:01Z |
NOTE: this thread was migrated from projectzero.org. Some content and formatting may have been lost in the move.


Originally posted by projectzero userid: purp56 - f=4&t=2331#p9437
Hello,

I encounter the following error when attempting to execute an SQL statement to create an index via runsql from the CLI:

command> zero runsql config/sql/indx1.sql
CWPZC9063E: Failed to execute ->
CREATE INDEX INDX1 ON CHANGES (startDate ASC, startTime ASC)
CWPZC9021E: <Local transaction: 87b792aa-0e5a-47ba-933b-7b3987ad87f0> failed
CWPZC9061E: An error occurred in executing config/sql/indx1.sql
'CREATE INDEX' cannot be performed on 'CHANGES' because it does not exist.
CWPZT0601E: Error: Command runsql failed

The resource file is named changes.groovy and the model file is named changes.json.

The zero model sync successfully created the table named CHANGES:
command> zero model sync
CWPZC9225I: Using default Derby database configuration. Located at -> db/resource in application root.
CWPZC9223I: Found 1 model types
CWPZC9212I: Created table -> CHANGES for Type -> changes using SQL ->
CREATE TABLE changes (
status VARCHAR(100) NOT NULL,
l2assigned VARCHAR(500),
....
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 100, INCREMENT BY 1) NOT NULL,
updated TIMESTAMP NOT NULL
)
CWPZT0600I: Command model sync was successful


The contents of the zero.config file:

<br/> # HTTP port (

default is 8080)<br/> /config/http/port = 8080<br/> <br/> # Runtime mode (

default is 
"production")<br/> /config/runtime/mode=
"development"<br/> <br/> /config/contextRoot=
"/gpschanges"  <br/> <br/> /config/db/changes= 
{<br/> 
"class" : 
"org.apache.derby.jdbc.EmbeddedDataSource",<br/> 
"databaseName" : 
"db/changes",<br/> 
"createDatabase" : 
"create"    # 

this line is optional, but use it to create a db 

if one doesn
't already exist<br/> 
}<br/> /config/defaults/dbKey = 
"changes"<br/>


The contents of the file indx1.sql:

<br/> CREATE INDEX INDX1 ON CHANGES (startDate ASC, startTime ASC);<br/>


The same error occurred when i invoked the runsql with the dbkey as in:
command> zero runsql changes config/sql/indx1.sql

Any help will be greatly appreciated
Thanks
cp