db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malte Stien <malte.st...@stien.de>
Subject Re: Map objects to different databases
Date Thu, 24 Apr 2003 21:35:36 GMT
On Thursday 24 April 2003 19:27, Frederic Gedin wrote:
> 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.
In order to make it work, I certainly have to generated a database AND use it 
during runtime.

> 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.
Do you use two databases during runtime as well?

> Some ideas on what you could check:
>   - are you using Torque 3.0?
Yes, I do.

>   - 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?
I do not have any compilation errors. My problem is not, that I cannot compile 
the code or that Torque does not generate the Java code correctly. The 
problem is just, that Torque does not generate initialization code (i.e. the 
sql script) to setup two databases. So, it will not use two databases during 
runtime as well. I just want to convince Torque, that some of the tables are 
in the project database and others are in the project master database. Torque 
has to consider that for the database generation as well as for the database 
runtime usage. But at the moment the first step already fails.

Best regards,

> Regards
> Frederic
> >On Thursday 24 April 2003 16:50, Frederic Gedin wrote:
> >>Hi
> >>
> >>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?
> >>
> >>Regards
> >>
> >>Frederic
> >>
> >>Malte Stien wrote:
> >>>Hello,
> >>>
> >>>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...
> >>>
> >>>torque.database.proj.adapter=postgresql
> >>>torque.dsfactory.proj.factory=org.apache.torque.dsfactory.TorqueDataSour
> >>>ce Factory torque.dsfactory.proj.pool.defaultMaxConnections=10
> >>>torque.dsfactory.proj.pool.maxExpiryTime=3600
> >>>torque.dsfactory.proj.pool.connectionWaitTimeout=10
> >>>torque.dsfactory.proj.connection.driver = org.postgresql.Driver
> >>>torque.dsfactory.proj.connection.url =
> >>>jdbc:postgresql://localhost:5432/proj
> >>>torque.dsfactory.proj.connection.user = postgres
> >>>torque.dsfactory.proj.connection.password =
> >>>
> >>>torque.dsfactory.projmaster.factory=org.apache.torque.dsfactory.TorqueDa
> >>>ta SourceFactory
> >>> torque.dsfactory.projmaster.pool.defaultMaxConnections=10
> >>> torque.dsfactory.projmaster.pool.maxExpiryTime=3600
> >>>torque.dsfactory.projmaster.pool.connectionWaitTimeout=10
> >>>torque.dsfactory.projmaster.connection.driver = org.postgresql.Driver
> >>>torque.dsfactory.projmaster.connection.url =
> >>>jdbc:postgresql://localhost:5432/projmaster
> >>>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>
> >>><database name="proj"...>
> >>> ...
> >>></database>
> >>>
> >>>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.
> >>>Malte.

View raw message