You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Malte Stien <ma...@stien.de> on 2003/04/30 05:21:29 UTC

How to initialize and shutdown Torque without a properties-file

Hi,

is there any way to...

- initialize Torque without providing a file with all the properties (as in 
Torque.properties)?
I have to let the user specify the database settings during runtime of my 
application and so I have to pass the values on to Torque somehow.

- shuting down Torque properly?
The user shall be able to change the database he/she works on during runtime, 
so I have to be able to shut Torque down and initialize it again. I tried the 
Torque.shutdown() method but it does not seem to shutdown Torque properly. I 
one calls Torque.isInit() after calling Torque.shutdown() Torque still seems 
to be initialized.

Thanks for support.
Malte.

Multiple Inheritance?

Posted by Malte Stien <ma...@stien.de>.
Hi,

does Torque support multiple inheritance or can it be emulated in a sort of 
clever way? At the moment, I have solved that by not using Torque inheritance 
at all but introducing normal relationships between classes that represent 
"is superclass/subclass of". Unfortunately, that gets a bit messy during 
implementation of the business logic. Is there a better way?

Thanks
Malte.

Re: How to initialize and shutdown Torque without a properties-file

Posted by Malte Stien <ma...@stien.de>.
Hi,

sorry, I just had time to test that because I had to meet a deadline last week 
and what had to be shown there worked fine with the Torque.properties file.

I tried that and it actually did not work. I tried some variations but I can 
not make it work. It there a reference for the Torque.properties-file 
somewhere? I only can find the one for the build.properties-file.

Especially, I have the following questions:
- What does the torque.database.default-property acutally do? What happens if 
I do not specify it?
- Why do the key-strings in the Torque.properties-file carry a dsfactory in 
them and the key-strings in the example below (see quote) not.
- I presume in the example above "rego" is the database name. Is that right? 
So I put in "prj" in my case. Where does "database" come from. It is not in 
the Torque.properties-file.

If I adapt what you suggested, it looks like:
torqueConfig.addProperty("torque.database.default", "prj");
torqueConfig.addProperty("torque.database.prj.driver","org.postgresql.Driver");
torqueConfig.addProperty("torque.database.prj.url", connectionString);
torqueConfig.addProperty("torque.database.prj.username", "postgres");
torqueConfig.addProperty("torque.database.prj.password", "");
Torque.init(torqueConfig);
The connectionString looks like this: jdbc:postgresql://localhost:5432/prj

Or should it look like:
torqueConfig.addProperty("torque.database.default", "prj");
torqueConfig.addProperty("torque.database.prj.adapter", "postgresql");
torqueConfig.addProperty("torque.dsfactory.prj.connection.driver","org.postgresql.Driver");
torqueConfig.addProperty("torque.dsfactory.prj.factory","org.apache.torque.dsfactory.TorqueDataSourceFactory");
torqueConfig.addProperty("torque.dsfactory.prj.connection.url",connectionString);
torqueConfig.addProperty("torque.dsfactory.prj.connection.user","postgres");
torqueConfig.addProperty("torque.dsfactory.prj.connection.password", "");
Torque.init(torqueConfig);

However, neither of the two options and many others that I tried, work 
although it works with my Torque.properties-file.

Thanks for any help on that.
Malte.

On Thursday 01 May 2003 06:21, Geoff Fortytwo wrote:
> BaseConfiguration torqueConfig = new BaseConfiguration();
> torqueConfig.addProperty("log4j.rootCategory","DEBUG,default");
> torqueConfig.addProperty("log4j.appender.default","org.apache.log4j.FileApp
>ender");
>
> torqueConfig.addProperty("log4j.appender.default.file","/jrun/logs/default/
>torque.log");
>
> torqueConfig.addProperty("log4j.appender.default.layout","org.apache.log4j.
>SimpleLayout"); torqueConfig.addProperty("torque.database.default","FAKE");
> torqueConfig.addProperty("torque.database.rego.driver","oracle.jdbc.driver.
>OracleDriver");
>
> torqueConfig.addProperty("torque.database.rego.url","FAKE");
> torqueConfig.addProperty("torque.database.rego.username","FAKE");
> torqueConfig.addProperty("torque.database.rego.password","FAKE");
> org.apache.torque.Torque.init(torqueConfig);
>
> At 08:21 PM 4/29/2003, you wrote:
> >Hi,
> >
> >is there any way to...
> >
> >- initialize Torque without providing a file with all the properties (as
> > in Torque.properties)?
> >I have to let the user specify the database settings during runtime of my
> >application and so I have to pass the values on to Torque somehow.
> >
> >- shuting down Torque properly?
> >The user shall be able to change the database he/she works on during
> > runtime, so I have to be able to shut Torque down and initialize it
> > again. I tried the Torque.shutdown() method but it does not seem to
> > shutdown Torque properly. I one calls Torque.isInit() after calling
> > Torque.shutdown() Torque still seems to be initialized.
> >
> >Thanks for support.
> >Malte.
> >
> >---------------------------------------------------------------------
> >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



Re: How to initialize and shutdown Torque without a properties-file

Posted by Geoff Fortytwo <g4...@ign.com>.
BaseConfiguration torqueConfig = new BaseConfiguration();
torqueConfig.addProperty("log4j.rootCategory","DEBUG,default");
torqueConfig.addProperty("log4j.appender.default","org.apache.log4j.FileAppender"); 

torqueConfig.addProperty("log4j.appender.default.file","/jrun/logs/default/torque.log"); 

torqueConfig.addProperty("log4j.appender.default.layout","org.apache.log4j.SimpleLayout");
torqueConfig.addProperty("torque.database.default","FAKE");
torqueConfig.addProperty("torque.database.rego.driver","oracle.jdbc.driver.OracleDriver"); 

torqueConfig.addProperty("torque.database.rego.url","FAKE");
torqueConfig.addProperty("torque.database.rego.username","FAKE");
torqueConfig.addProperty("torque.database.rego.password","FAKE");
org.apache.torque.Torque.init(torqueConfig);


At 08:21 PM 4/29/2003, you wrote:
>Hi,
>
>is there any way to...
>
>- initialize Torque without providing a file with all the properties (as in
>Torque.properties)?
>I have to let the user specify the database settings during runtime of my
>application and so I have to pass the values on to Torque somehow.
>
>- shuting down Torque properly?
>The user shall be able to change the database he/she works on during runtime,
>so I have to be able to shut Torque down and initialize it again. I tried the
>Torque.shutdown() method but it does not seem to shutdown Torque properly. I
>one calls Torque.isInit() after calling Torque.shutdown() Torque still seems
>to be initialized.
>
>Thanks for support.
>Malte.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org