Did your define the database properties in TurbineResources.properties for
the 'shop' database:

Made up example:

database.shop.driver=org.gjt.mm.mysql.Driver
database.shop.url=jdbc:mysql://localhost:3306/shop
database.shop.username=username
database.shop.password=password


-----Original Message-----
From: St�phane MOR
To: [EMAIL PROTECTED]
Sent: 2/24/02 9:41 PM
Subject: Turbine 2.1 - Torque : How to access the data ?

Hello,

I'm very enthusiasthic about Turbine, and moreover about Torque.
This is why I started using Turbine (2.1, awaiting decoupled versions
!).
Templates, Layouts, Navigations and Screens work fine, but I can't use
any
Torque
code !

I read each and every HOW-TO, tutorial on Turbine's site, but couldn' t
find
any answer to
"how to integrate Torque in Turbine ?".
Analysing the TDK's source code didn't help as Flux is integrated as a
tool,
which is a
quite different thing (I think so, at least).

In my own app, Flux tool works fine, and I can access Roles,
Permissions,
etc.
easily but my data can't be accessed, whereas they are both sharing the
same
database.

To start simple I only have this configuration :

- a schema : shop-schema.xml :
<database name="shop">
    <table name="customer">
        <column name="id" size="99" type="VARCHAR"/>
        <column name="name" size="99" type="VARCHAR"/>
    </table>
</database>
which generated the appropriate CustomerPeer, CustomerBase and Customer.
I have no problems at all with schemas and Torque Ant Tasks.

- a screen : ${package}.modules.screens.Default
public class Default extends VelocityScreen
{
    public void doBuildTemplate(RunData data, Context context) throws
Exception
    {
        Criteria crit = new Criteria();
        Vector customers = CustomerPeer.doSelect(crit);
        context.put("customers", customers);
    }
}
I am not sure at all that this code should be there ...

- a template : ${WEBAPP_ROOT}/templates/app/screens/Default.vm
The customers :<br/>
#foreach ( $customer in $customers )
Name : $customer.Name   ,     ID : $customer.Id    <br/>
#end
I tried using fake Customer classes instead of the Torque ones with
success
in this
template.

When trying to retrieve my data, i get a : " java.SQL.SQLException :
Connection Object
is null ! " log in turbine.log , and a redirection to the error
template.

What I would like is a very basic and simple plan to integrate Torque in
Turbine :
1) configure Turbine like that (actually as Flux works I guess it is
correctly configured )
2) write your Criteria code in this class (Action ? Screen ?)
3) initialize the connection like this
etc.

This is the last thing that prevents me from switching definitely to
Turbine, so I hope it
can be solved !

Thanks a lot (even without Torque I had a great pleasure discovering and
playing with
Turbine !).

Stephane




_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com




--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to