db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: (newbie) Error creating db with Postgres
Date Tue, 05 Jul 2005 07:59:14 GMT




Hi,

Usually, if an SQL error is thrown during the execution, this does not mean
that the whole build fails. When _TESTING_ against postgresql 7.3, I get
errors all the time because the database cannot be dropped, some tables
cannot be dropped(because of lingering constraints) and then they cannot be
created again(because they already exist) etc.
For testing, this is ok; in production, I would not let maven touch the
database under any circumstances. There, I take the created db scripts,
edit them (if needed) and execute them by hand. (It is still a great thing,
though, that the scripts are generated automatically).

I have not looked deeply intop the create-db procedure in postgresql and
whether it can be done automatically, but if it works manually, do it
manually .Then skip the create-db target and you should be fine.

      Thomas

"Matthias Klein" <matthias@cmklein.de> schrieb am 04.07.2005 22:18:09:

> Today I tried adapting the tutorial example to postgresql but create-db
> resulted in errors.
> I did search the mailing list and documentation but could not find an
> answer.
>
> Here is what I did:
>
> 1. Installed PostgreSQL 8.0 (build 311) on localhost port 5432 with user
> postgres/postgres
>
> 2. Created a dir "torquetest" in which I placed torque-3.1.1.jar and
> torque-gen-3.1.1.jar
>
> 3. Placed the JDBC driver in %MAVEN_HOME%/lib/endorsed (The documentation
> doesn't mention that the driver has to be there. BTW: is there another
> (better) way to do that? Adding the driver to the classpath didn't work:
> driver could not be loaded)
>
> 4. Created id-table-schema.xml and project-schema.xml and placed them in
> /src/schema. The content of those files is just copy&paste from the
tutorial
>
> 5. created project.properties in torquetest:
>
> torque.project = bookstore
> torque.database = postgresql
> torque.targetPackage = ca.nrc.test.om
> torque.database.createUrl = jdbc:postgresql://localhost:5432
> torque.database.buildUrl = jdbc:postgresql://localhost:5432/bookstore
> torque.database.url = jdbc:postgresql://localhost:5432/bookstore
> torque.database.driver = org.postgresql.Driver
> torque.database.user = postgres
> torque.database.password = postgres
> torque.database.host = localhost
>
> 6. created log4j.properties in torquetest (also copy&paste)
>
> 7. Ran maven plugin:download -DartifactId=maven-torque-plugin
> -DgroupId=torque -Dversion=3.1.1
>
> Now I ran maven torque which worked fine and created those peer classes.
>
>
> But with maven torque:create-db I got an error:
>
> build:start:
>
> torque:init:
>
> torque:create-db:
>     [torque-data-model] Using classpath
>     [torque-data-model] Generating to file
> C:\JavaCode\torquetest\target\sql\cre
> ate-db.sql
>     [echo]
>           Executing the create-db.sql script ...
>
>
> BUILD FAILED
> File...... C:\Documents and
> Settings\Matthias\.maven\cache\maven-torque-plugin-3
> .1.1\plugin.jelly
> Element... sql
> Line...... 394
> Column.... 44
> org.postgresql.util.PSQLException: Backend start-up failed: FATAL:
database
> "boo
> kstore" does not exist.
> Total time: 4 seconds
> Finished at: Mon Jul 04 22:12:03 ADT 2005
>
>
> Now I created bookstore manually but then I got a message that the build
> failed because the db already existed and could not be dropped.
>
> I assume this is a very trivial config problem. But I can't seem to find
the
> solution.
> Any suggestions?
>
> Thanks
>
> Matt
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message