Setup-db and PostgreSQL 8.1 problem

Krzysztof Borkowski <[email protected]>
Newsgroups gmane.comp.jakarta.ojb.user
Organization Noktrim
Message-ID <[email protected]>
Dear ojb-user mailing list subscribers!

I have just started my adveture with OJB. I've read the "Getting
Started" and FAQ and have tried to launch the ojb_blank. It works great
with the Hsqldb but don't want to work with PostgreSQL.

The problem is the setup-db target. It seems that the target can't work
because it tries to remove tables before it try to create them. The
tables are not present in the database so the whole process is going to 
nowhere. Here is a feedback from ant (the output is a mess so please find the 'add-shutdown-sql-file' target and look at next 5 lines):

"
D:\_0\ojb-blank>ant setup-db
Buildfile: build.xml

compile:

xdoclet:
[ojbdoclet] 2006-08-13 02:53:24,044 [main] INFO  xdoclet.XDocletMain.start - Running <ojbrepository/>
[ojbdoclet] 2006-08-13 02:53:24,926 [main] INFO  xdoclet.XDocletMain.start - Running <torqueschema/>

setup-db:

check-use-classpath:

check-run-only-on-schema-change:

sql-check:

sql:
     [echo] +------------------------------------------+
     [echo] |                                          |
     [echo] | Generating SQL for YOUR Torque project!  |
     [echo] |                                          |
     [echo] +------------------------------------------+

sql-classpath:
     [echo] loading templates from classpath
[torque-sql] Using contextProperties file: D:\_0\ojb-blank\build.properties
[torque-sql] Using classpath
[torque-sql] Generating to file D:\_0\ojb-blank\build\database\report.ojb_blank.sql.generation
[torque-sql] 2006-08-13 02:53:27,820 [main] INFO  org.apache.torque.engine.database.transform.XmlToAppData - Parsing fil
e: 'ojbcore-schema.xml'
[torque-sql] 2006-08-13 02:53:27,890 [main] INFO  org.apache.torque.engine.database.transform.DTDResolver - Resolver: us
ed database.dtd from 'org.apache.torque.engine.database.transform' package
[torque-sql] 2006-08-13 02:53:28,000 [main] INFO  org.apache.torque.engine.database.transform.XmlToAppData - Parsing fil
e: 'project-schema.xml'
[torque-sql] 2006-08-13 02:53:28,030 [main] INFO  org.apache.torque.engine.database.transform.DTDResolver - Resolver: us
ed database.dtd from 'org.apache.torque.engine.database.transform' package

sql-template:

create-db-check:

create-db:
[torque-data-model] Using classpath
[torque-data-model] Generating to file D:\_0\ojb-blank\build\database\create-db.sql
[torque-data-model] 2006-08-13 02:53:40,458 [main] INFO  org.apache.torque.engine.database.transform.XmlToAppData - Pars
ing file: 'ojbcore-schema.xml'
[torque-data-model] 2006-08-13 02:53:40,468 [main] INFO  org.apache.torque.engine.database.transform.DTDResolver - Resol
ver: used database.dtd from 'org.apache.torque.engine.database.transform' package
[torque-data-model] 2006-08-13 02:53:40,568 [main] INFO  org.apache.torque.engine.database.transform.XmlToAppData - Pars
ing file: 'project-schema.xml'
[torque-data-model] 2006-08-13 02:53:40,568 [main] INFO  org.apache.torque.engine.database.transform.DTDResolver - Resol
ver: used database.dtd from 'org.apache.torque.engine.database.transform' package

shutdown-check:

append-shutdown-sql:
     [echo]
     [echo]       Executing the create-db.sql script ...
     [echo]
      [sql] Executing file: D:\_0\ojb-blank\build\database\create-db.sql
      [sql] 2 of 2 SQL statements executed successfully

insert-sql:

shutdown-check:

add-shutdown-sql-file:
[torque-sql-exec] Our new url -> jdbc:postgresql://localhost/ojb_blank
[torque-sql-exec] Executing file: D:\_0\ojb-blank\build\database\project-schema.sql
[torque-sql-exec] Failed to execute: DROP TABLE Product CASCADE; CREATE TABLE Product ( id integer NOT NULL, name varcha
r (100), price float, stock integer, PRIMARY KEY (id) );
[torque-sql-exec] org.postgresql.util.PSQLException: ERROR: table "product" does not exist
[torque-sql-exec] Executing file: D:\_0\ojb-blank\build\database\ojbcore-schema.sql
[torque-sql-exec] Failed to execute: DROP TABLE OJB_HL_SEQ CASCADE; CREATE TABLE OJB_HL_SEQ ( TABLENAME varchar (250) NO
T NULL, MAX_KEY int8, GRAB_SIZE integer, VERSION integer, PRIMARY KEY (TABLENAME) ); DROP TABLE OJB_NRM CASCADE; CREATE
TABLE OJB_NRM ( NAME varchar (250) NOT NULL, OID_ bytea, PRIMARY KEY (NAME) ); DROP TABLE OJB_DLIST CASCADE; CREATE TABL
E OJB_DLIST ( ID integer NOT NULL, SIZE_ integer, PRIMARY KEY (ID) ); DROP TABLE OJB_DLIST_ENTRIES CASCADE; CREATE TABLE
 OJB_DLIST_ENTRIES ( ID integer NOT NULL, DLIST_ID integer NOT NULL, POSITION_ integer, OID_ bytea, PRIMARY KEY (ID) );
DROP TABLE OJB_DSET CASCADE; CREATE TABLE OJB_DSET ( ID integer NOT NULL, SIZE_ integer, PRIMARY KEY (ID) ); DROP TABLE
OJB_DSET_ENTRIES CASCADE; CREATE TABLE OJB_DSET_ENTRIES ( ID integer NOT NULL, DLIST_ID integer NOT NULL, POSITION_ inte
ger, OID_ bytea, PRIMARY KEY (ID) ); DROP TABLE OJB_DMAP CASCADE; CREATE TABLE OJB_DMAP ( ID integer NOT NULL, SIZE_ int
eger, PRIMARY KEY (ID) ); DROP TABLE OJB_DMAP_ENTRIES CASCADE; CREATE TABLE OJB_DMAP_ENTRIES ( ID integer NOT NULL, DMAP
_ID integer NOT NULL, KEY_OID bytea, VALUE_OID bytea, PRIMARY KEY (ID) );
[torque-sql-exec] org.postgresql.util.PSQLException: ERROR: table "ojb_hl_seq" does not exist
[torque-sql-exec] 0 of 2 SQL statements executed successfully

BUILD SUCCESSFUL
Total time: 33 seconds
"

I'm using:
  - MS Windows XP SP2
  - JDK 1.5.0_07
  - ant 1.6.5
  - PostgreSQL 8.1.4 for Windows. The server is installed on my comuter so the database connection points to the localhost

Please help with that for I don't have any more ideas what should I do (of course I don't want to create tables by hand if such a great tools like OJB and Torque exist).

Thank you in advance.

Krzysztof Borkowski
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.