db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramesh Sabeti" ...@reazon.com>
Subject RE: Accessing multiple databases from One Torque Application
Date Thu, 11 Dec 2003 06:24:46 GMT
Jeff,

> Did you generate the Torque code for both databases together(Using one
> build.properties file)?

No, I did them separately.

> Does Torque handle the objects the same way for the second DB?
> (Does calling the .save() method on the database objects save to the
> correct database? I don't understand what you use the
> Torque.getConnection("seconddb") line for.)

Actually I use my second database connection differently and don't call
.save().  

I think you can make that work by making the "correct setting" in the
build.properties files, but I don't know what that "correct setting"
would be... sorry.  Here's a hint: all Base*Peer.java files have the
following declaration:

	public static final String DATABASE_NAME = "default";

After you make the "correct setting", you should see the second database
name instead of "default" instead.  Once that is made, .save() should
point to the right database.

If I have time I'll dig around some more.  Let us know what you find out
please.

Ramesh.



> 
> Thanks again for your support and the support of the list.
> 
> Jeff Rasmussen
> 
> On Wed, 2003-12-03 at 11:09, Ramesh Sabeti wrote:
> > This is how I'm doing it:
> >
> > Create another set of entries for your second connection in
> > torque.properties. The first one can remain as the default
connection
> > and the second one would be a named connection.  So if the first one
is:
> >
> > torque.database.default=default
> > torque.database.default.adapter=oracle
> >
> > torque.dsfactory.default.connection.driver =
> > oracle.jdbc.driver.OracleDriver
> > ... followed by the rest of the setup
> >
> > The second one is setup as:
> >
torque.dsfactory.seconddb.factory=org.apache.torque.dsfactory.TorqueData
> > SourceFactory
> > torque.dsfactory.seconddb.pool.defaultMaxConnections=10
> > ... followed by the rest of the setup
> >
> > In your app, you can get a connection to the second db as follows:
> > Torque.getConnection("seconddb")
> >
> > Hope it helps,
> >
> > Ramesh.
> >
> >
> > > -----Original Message-----
> > > From: Jeff Rasmussen [mailto:jrasmussen@lnxi.com]
> > > Sent: Wednesday, December 03, 2003 9:21 AM
> > > To: 'Apache Torque Users List'
> > > Subject: Accessing multiple databases from One Torque Application
> > >
> > > 	I have the need to access a mysql database and a odbc database
> > from
> > > the
> > > same web application,  I have successfully been running the torque
> > with
> > > the mysql db and would like to use torque for both connections. I
have
> > > referenced the documentation and have not seen anything addressing
> > this
> > > issue. Any past experience or links to documentation(If I missed
it
> > > somewhere) would be greatly appreciated.
> > >
> > > 	I also could use some in-site on using the JDBC-ODBC bridge
> > driver.
> > > I
> > > read on sun's website that this driver should only be used as a
last
> > > resort. Does anyone know of a better way to connect to proprietary
> > DB's
> > > through ODBC?
> > >
> > > Many Thanks,
> > >
> > > Jeff Rasmussen
> > >
> > >
> > >
---------------------------------------------------------------------
> > > 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



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


Mime
View raw message