You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Michael Kunze <mi...@chaos-inc.de> on 2005/01/21 16:06:59 UTC

How to enable DB Support

Hi,
i finally got the demo site into tomcat so the meta thing worked fine. 
now i'm trying to get the database running.
i wonna use mysql. the meta setup created a lot of property files with 
alot of properties for the database (defaults and application specific).

so where exactly am i suppose to put my connection details? which file 
overwrites which (in property loading squence speaking). and what maven 
goals do i have to call afterwards?

i hope to get help this time ;(

michael

-- 
Michael Kunze
http://www.smrealms.de

How much Sex can you have? - I don't know. I havn't maxed out yet.
(John Crichton in Farscape)

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


Re: How to enable DB Support

Posted by Jeffery Painter <pa...@kiasoft.com>.
I created a small set of instructions that helped me get started using 
torque with M.E.T.A. Maybe this will help you

-----------------------------------------------------------------------
Creating a new application with META (Maven Environment for Turbine 
Appliations)

Inplace development mode::

1. Install your servlet container and create a build.properties file in 
your home directory.

----------------------------------------------------------------------------
    #
    # build.properties - for META
    #

    #
    # Application Server configuration
    #
    maven.appserver.home = <directory_for_appserver_home>
    maven.appserver.name = tomcat

    #
    # app config
    #
    turbine.app.name = <appname>
    turbine.app.flavor=turbine-2.3.1

    #
    # create the om layer interfaces for torque
    #
    turbine.app.om.layer=torque

    #
    # don't create demo pages
    #
    turbine.app.setup.demo=false

    #
    # Inplace dev mode
    #
    turbine.plugin.mode=inplace

    #
    # Initial ID values for the ID_TABLE
    #
    initialID = 1100
    initialIDValue = 100
    initialIDStep = 10

    #
    # database settings
    #
    torque.database=mysql
    torque.database.driver = com.mysql.jdbc.Driver
    torque.database.user = myuser
    torque.database.password = mypassword
    torque.database.buildUrl = jdbc:mysql://localhost/<appname>
    torque.database.createUrl = jdbc:mysql://localhost/<appname>

----------------------------------------------------------------------------

2. change to the webapps directory of your servlet container.
3. Create the skeleton for the app

    % maven -Dturbine.setup.properties=~/build.properties turbine:setup

4. change into your webapps/<newapp> directory

5. modify the <appname>-schema.xml accordingly (found in 
   src/schema/<appname>-schema.xml)

6. Create SQL (all commands run from webapps/<appname> directory

    1. create the database
    % maven torque:create-db

    2. generate SQL code
    % maven turbine:sql

    3. put SQL in database
    % maven torque:insert-sql

7. Compile your application

    % maven java:compile

no need to deploy since we are inplace development mode

-----------------------------------------------------------------------



-- 
Jeffery Painter
    2431 Reunion Meadows Lane
    Apex, NC 27539
    voice: 919.321.0378

- --
painter@kiasoft.com                http://jeff.kiasoft.com
PGP FP: 9CE8 83A2 33FA 32B1 0AB1  4E62 E4CB E4DA 5913 EFBC

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/qEQE5Mvk2lkT77wRAnMJAJ9vJ6qOkg/mvqqIpz7troCEQJ8bFACglu/U
YNXabx7DZOV2Hd9LwSTmGpY=
=dWiu
-----END PGP SIGNATURE-----

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


Re: How to enable DB Support

Posted by Michael Kunze <mi...@chaos-inc.de>.
David Demner wrote:

> You put them in %WEBAPPROOT%\WEB-INF\conf\torque.properties

Did that, but still not working. Got this:

 > maven torque:create-db

BUILD FAILED
File...... C:\Documents and 
Settings\USER\.maven\cache\maven-torque-plugin-3.1.1\plugin.jelly
Element... sql
Line...... 394
Column.... 44
Class Not Found: JDBC driver  could not be loaded


So i checked that line.

<sql
    autocommit="true"
    driver="${torque.database.driver}"
    onerror="continue"
    password="${torque.database.password}"
    src="${torque.sql.dir}/create-db.sql"
    url="${torque.database.createUrl}"
    userid="${torque.database.user}">
    <classpath refid="torque-classpath"/>
</sql>

Obviously it wants torque.database.*
So i tried to set these properties:

torque.database.createUrl = jdbc:mysql://localhost:3306/
torque.database.buildUrl = jdbc:mysql://localhost:3306/dbkg
torque.database.url = jdbc:mysql://localhost:3306/dbkg
torque.database.driver = org.gjt.mm.mysql.Driver
torque.database.user = dbkg
torque.database.password = *******
torque.database.host = localhost

Still no luck. Same result.

But maven -X says that 
.maven\repository\mysql\jars\mysql-connector-java-2.0.14-bin.jar is in 
the classpath. I'm lost.

Any wild guesses?

-- 
Michael Kunze
http://www.smrealms.de

How much Sex can you have? - I don't know. I havn't maxed out yet.
(John Crichton in Farscape)

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


RE: How to enable DB Support

Posted by David Demner <tu...@demner.com>.
Hi Michael,

You put them in %WEBAPPROOT%\WEB-INF\conf\torque.properties

I'm using JNDI (see
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html),
and have the following in torque.properties:

torque.database.pas.adapter = 	mysql
torque.dsfactory.pas.factory =
org.apache.torque.dsfactory.JndiDataSourceFactory
torque.dsfactory.pas.jndi.path =    java:comp/env/jdbc/blahblah

And have mysql-connector-java-3.0.11-stable-bin.jar in tomcat's common\lib
directory.

Good luck,

David

-----Original Message-----
From: Michael Kunze [mailto:michael.kunze@chaos-inc.de] 
Sent: Friday January 21, 2005 7:07 AM
To: turbine-user@jakarta.apache.org
Subject: How to enable DB Support


Hi,
i finally got the demo site into tomcat so the meta thing worked fine. 
now i'm trying to get the database running.
i wonna use mysql. the meta setup created a lot of property files with 
alot of properties for the database (defaults and application specific).

so where exactly am i suppose to put my connection details? which file 
overwrites which (in property loading squence speaking). and what maven 
goals do i have to call afterwards?

i hope to get help this time ;(

michael

-- 
Michael Kunze
http://www.smrealms.de

How much Sex can you have? - I don't know. I havn't maxed out yet.
(John Crichton in Farscape)

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


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