db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic Gedin <frederic.ge...@Jaluna.COM>
Subject Re: Map objects to different databases
Date Thu, 24 Apr 2003 09:27:58 GMT
Hi Malte

Malte Stien wrote:

>thank you for your answer. My problem is as follows: I am working on an 
>application where the user can enter and retrieve information that is to be 
>stored in a database that is specific to the particular project the user is 
>working on. (I use the word database here in the sense of a set of tables 
>rather than a RDBMS.) Each project n has a particular project database n the 
>information for this particular project is stored in. In addition - while the 
>user is working on a particular project - information is needed that is 
>common to all projects. This information is to be stored in the project 
>master database.
>Hence, during runtime I need access to one of the project databases and the 
>project master database. Thus, some classes are to be mapped to tables in the 
>project master database while others are to be mapped to a particular project 
>database. The project databases are all subject to the same schema. This 
>schema is different from the schema for the project master database. All 
>databases are held on a Postgresql database server. The project databases are 
>always kept on the same database server as the project master database.
>The user shall be able specify the project he/she wishes to work on and the 
>system opens the corresponding project database and - fully independent of 
>the project selected - the project master database. So somehow, I have to 
>convince Torque not to use the Torque.properties file but to be able to 
>specify the database during runtime.
>I hope, that explains my problem a bit better. Any help is highly appreciated.
>Thank you. Malte.
I am still not sure to understand if your problem comes from the 
database generation or from the database runtime usage.  Assuming, it is 
a runtime usage problem, Torque reads database information (i.e. 
location , driver, user password) at the initialization time.  If you 
want to change database information without having to restart your 
application, maybe should you consider using OJB instead of Torque.  If 
you still want to use Torque, may should you call  Torque.init to reread 
the configuration but I am not sure that this will work if Torque has 
already been initialized.

Reading your Torque.properties extract, I do not see the cause of your 
problem: it looks like mine except that I use MySQL instead of postgres.

Some ideas on what you could check:
  - are you using Torque 3.0?
  - are you sure you do not have java class names which conflict between 
the project and the master databases?
  - are you sure that no error or exception message has been generated 
at build time?



>On Thursday 24 April 2003 16:50, Frederic Gedin wrote:
>>Is your problem related to the generation of the databases or to the
>>runtime use?
>>I never succeeded to generate two databases. Actually, I did not really
>>try very much as my second database comes with an other application.
>> However, using two databases at runtime works fine for me.
>>Could you be more specific regarding your problem?
>>Malte Stien wrote:
>>>I am new to torque. I set it up and went through the tutorial. It seems to
>>>work so far. I need it for a particular project. So I have two questions:
>>>1. How do I map different objects to tables in different databases. I
>>>thought, that I can just configure two databases in Torque.properties...
>>>Factory torque.dsfactory.proj.pool.defaultMaxConnections=10
>>>torque.dsfactory.proj.connection.driver = org.postgresql.Driver
>>>torque.dsfactory.proj.connection.url =
>>>torque.dsfactory.proj.connection.user = postgres
>>>torque.dsfactory.proj.connection.password =
>>>SourceFactory torque.dsfactory.projmaster.pool.defaultMaxConnections=10
>>>torque.dsfactory.projmaster.connection.driver = org.postgresql.Driver
>>>torque.dsfactory.projmaster.connection.url =
>>>torque.dsfactory.projmaster.connection.user = postgres
>>>torque.dsfactory.projmaster.connection.password =
>>>... and then use the names "proj" and "projmaster" in my schema file.
>>><database name="projmaster"...>
>>> ...
>>><database name="proj"...>
>>> ...
>>>But that does not seem to work. All my objects end up in projmaster no
>>>matter what database name I use in the schema. I cannot find really much
>>>in the documentation about that. Do the names used in the schema and the
>>>name used in the Torque.properties have to match or are they completely
>>>different things?
>>>2. How do I configure these two databases without using the
>>>Torque.properties file? I need the user to specify the database details.
>>>So I cannot use a static file. I cannot find really much in the
>>>documentation about that either.
>>>I would be really grateful for further help. Is there a book or a piece of
>>>good documentation apart from the javadocs? It seems not really to be
>>>documented in a verbose way.
>>>Thank you.
>>>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
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org

View raw message