Date: 2004-08-19T22:26:18
Editor: ScottEade <[EMAIL PROTECTED]>
Wiki: DB Torque Wiki
Page: GettingTorqueToWork
URL: http://wiki.apache.org/db-torque/GettingTorqueToWork
Remove a bunch of no longer relevant stuff, update the remainder.
Change Log:
------------------------------------------------------------------------------
@@ -8,42 +8,6 @@
----
-== Installing release 3.1 ==
-
-Note that the tutorial is in serious need of updating. It is based on Torque 3.0
which did not include the separated runtime and generation components nor the Torque
maven plugin. See TutorialErrata for details.
-
- * Basic install of torque and testing of example included in the tutorial
-
- * Download torque-3.1.zip and torque-gen-3.1.zip
-
-Extract the zips, you will now have <your_installation_path>/torque-3.1 folder and
<your_installation_path>/torque-gen-3.1 folder
-
- * Merge the folders and files from one folder into another (so you now have
everything under one folder)
-
-Edit build.properties (3 changes primarily -- torque.project , torque.database and
the database connection related setting.)
-
- * Create a project-schema.xml file under <your_installation_path>/schema folder
(you can copy the example given in the tutorials)
-
- * From the <your_installation_path> execute ant as follows
-{{{
- ant -f build-torque.xml
- ant -f build-torque.xml create-db
- ant -f build-torque.xml id-table-init-sql
- ant -f build-torque.xml insert-sql
-}}}
-
-
- * At the completion of the above steps you might notice the id-table is not
populated even if the sql is executed. Work around for this problem is to update your
build-torque.ml file as follows
-
-{{{
-Add the line
-<replace file="${torque.sql.dir}/sqldb.map" token="[EMAIL PROTECTED]@"
value="id-table-schema.sql=${database.name}" />
-after the target tag "insert-sql" and before the target tag <torque-sql-exec ..../>
-}}}
-
--- FreeSoul
-
-----
= Getting Torque to generate the schema and object files =
This is a listing of the typical problems people have trying to get Torque to
generate their object files and schema files.
@@ -58,47 +22,9 @@
-- StuartYeates
-A follow-up to Stuart's note (hmmm, maybe time-stamps would be useful? It's hard to
know how long ago people left this info.)[[BR]]
-I was also trying to extract the schema.xml file from an existing database, and kept
getting a file that had no table/column information in it. I found
[http://www.mail-archive.com/[EMAIL PROTECTED]/msg02396.html this post] describing my
problem; it turns out at least for postgresql 7.3.4 (which I'm using) you need the
schema name to be set, so adding ''torque.database.schema = public'' was the missing
link. Contrary to the docs, it's not just for Oracle and it doesn't have to be
upper-case.
-
--- RolandBevan (3/29/04)
-
tbd
- 1#2. My problem turned out to be fairly simple to fix. When I was browsing the site
I didn't find any references to what column types were allowed. I mistakenly put LONG
and BOOLEAN in. This causes the build to fail without any information on what went
wrong or where. After I changed my types to BIGINT and BIT everything worked
correctly. Below I am including the available types that I have found.
-
-{{{
-BIT
-, TINYINT
-, SMALLINT
-, INTEGER
-, BIGINT
-, FLOAT
-, REAL
-, DOUBLE
-, NUMERIC
-, DECIMAL
-, CHAR
-, VARCHAR
-, LONGVARCHAR
-, DATE
-, TIME
-, TIMESTAMP
-, BINARY
-, VARBINARY
-, LONGVARBINARY
-, NULL
-, OTHER
-, JAVA_OBJECT
-, DISTINCT
-, STRUCT
-, ARRAY
-, BLOB
-, CLOB
-, REF
-}}}
-
-They were found in my src/java/report.project.om.generation file.
+ 1#2. My problem turned out to be fairly simple to fix. When I was browsing the site
I didn't find any references to what column types were allowed. I mistakenly put LONG
and BOOLEAN in. This causes the build to fail without any information on what went
wrong or where. After I changed my types to BIGINT and BIT everything worked
correctly. Refer to the [http://db.apache.org/torque-31/generator/database.dtd.txt
DTD] for the available data types.
Hope this helps
@@ -110,10 +36,6 @@
--ls
-From the dtd, your list is right, except you missed BOOLEANINT and BOOLEANCHAR. Since
I haven't test these types yet, I just report they are perfectly acceptable types from
the DTD.
-
--- DanielSavard (2004-03-29)
-
This is somewhat related to the problem encountered by Pete. Received a
'generator.parse' error using the default target from Ant.
The problem turned out to be from a datatype in the source Oracle schema. Used the
torque 'jdbc' task and the resulting xxx-schema.xml file had an empty type attribute
for any columns which were defined as Timestamps in the source Oracle schema. Modified
the original ddl to change all Oracle 'Timestamp' columns over to the type 'Date'.
Once I rebuilt the schema in Oracle, re-ran the torque jdbc task, torque's default
(main) task worked fine.
@@ -290,18 +212,15 @@
= Installing from CVS =
-I did go through the following steps to build torque from CVS
-
- 1. Download Torque from CVS. See http://db.apache.org/torque/cvs-usage.html for
instructions.
+See: [http://db.apache.org/torque-31/developer-guide.html#Building Building]
- 2. Download and install maven (http://maven.apache.org/start/download.html). I used
maven 1.0-rc3 on Windows. Don't forget to set the environment variable MAVEN_HOME to
the appropriate directory and to add the maven binary directory to the environment
variable PATH.
+Some further hints:
- 3. Build torque: Run "maven jar" from the torque root diretory. Maven now downloads
some jar files. In the end, it complains about not being able to download jdbc-2.0.jar
and jndi-1.2.1.jar. As far as I know, jdbc 2.0 is contained in J2SE 1.4 and should
therefore not be needed separately if J2SE1.4.x is used, so I commented the jdbc
dependency in project.xml in torque's root directory. Another solution would probably
be to download thew jdbc-2.0 optional package from
http://java.sun.com/products/jdbc/download.html, but I did not try it. Then download
jndi-1_2_1.zip from http://java.sun.com/products/jndi/downloads/index.html, unpack it,
copy the file lib/jndi.jar into the directory .maven/repository/jndi/jars in your home
diretory and rename it to jndi-1.2.1.jar. Then run "maven jar" again. This will
download some more jar files, and build the library torque/torque-3.2-dev.jar. To
generate the documentation, run "maven site:generate". The documentation will be
generated in target/docs.
+ 1. When you install Maven, don't forget to set the environment variable MAVEN_HOME
to the appropriate directory and to add the maven binary directory to the environment
variable PATH.
- 4. Build the Torque Generator: change into the directory src/generator and run
"maven jar". It will download some jar files and build the library
src/generator/target/torque-gen-3.2-dev.jar. Again, the documentation will be
generated by running "maven site:generate". The documentation for the generator will
be generated in src/generator/target/docs.
+ 2. If/when Maven complains about not being able to download jdbc-2.0.jar and
jndi-1.2.1.jar you will need to download these manually and install them in your local
Maven repository. jndi-1_2_1.zip is available from
http://java.sun.com/products/jndi/downloads/ - copy the file lib/jndi.jar into the
directory .maven/repository/jndi/jars in your home diretory and rename it to
jndi-1.2.1.jar. Do same for other jars.
- 5. Build the Maven plugin(see also http://db.apache.org/torque/maven-howto.html):
change into the directory src/generator and run "maven plugin:install". Maven
complains about not being able to download torque-gen-3.2-dev.jar. But as this file
was already created, it can be copied from src/generator/target/torque-gen-3.2-dev.jar
to the .maven/repository/torque/jars in the home directory of the user. Running "maven
plugin:install" again seemed to create the plugin.
--- Thomas Fischer
+-- Thomas Fischer (with major edits by ScottEade)
= Using Torque with an existing database schema =
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]