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 Trey Long <ja...@provima.com> on 2005/11/01 22:30:37 UTC

JNDI, Connection Pool, Datasources - noob help

Alright guys, this list has been great for me since I am relatively new 
to the Java DB scene and I want to thank everyone that responds to this 
message in advance. Your input is greatly appreciated because I am still 
in a learning phase and experienced insights are invaluable.

Currently:
I have an application that is deployed on JBoss. We are using standard 
Java (pojo) and Torque for an abstraction to the database. I would like 
to setup a test to demonstrate the abstraction of Torque but I am stuck 
on trying to understand how Torque works together with other components 
to manage connections to the database. From reading I have determined 
that for a dynamic data source JNDI is the way to go, which leads me 
into the problem.

Problem:
I need the application to switch from using one data source to another. 
For instance, if I am using MSSQL server I would like to be able to 
switch to a mysql server on-the-fly. The times that my application will 
do this is relatively slim, but it's a good test. I would also like to 
store configuration information outside of the application source so 
that it can be configured on multiple deployments with the same source.

What I need from you:
I don't expect anyone to hack out the code to do this for me or 
something equally as silly. All I really want is some suggestions on how 
do to this, links to resources with things I need to know and perhaps 
explanations of some of the things you had trouble with or think I am 
doing wrong or going about the wrong way. It seems I am really lost on 
how the whole JNDI + Torque + other data source things work together in 
concert, much less how I can use them effectively.

Thanks for reviewing my message, Trey.

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


RE: JNDI, Connection Pool, Datasources - noob help

Posted by Thomas Fischer <fi...@seitenbau.net>.



Hi,

not sure whether it works, but one thing you can try with the 3.2-rcX
versions is to issue Torque.shutdown() and then initialize Torque again
using the configuration for the new data source. If you try that and run
into problems, please ask the list again.

Another thing you can do (should work also with Torque 3.1.x) is to
configure the different data sources in one file and change the database in
every criteria you use using criteria.setDbName(). For writing data to the
database, use the save(DbName) method everywhere. Read the javadoc for more
information.

    Thomas

Trey Long <ja...@provima.com> schrieb am 01.11.2005 22:30:37:

> Alright guys, this list has been great for me since I am relatively new
> to the Java DB scene and I want to thank everyone that responds to this
> message in advance. Your input is greatly appreciated because I am still
> in a learning phase and experienced insights are invaluable.
>
> Currently:
> I have an application that is deployed on JBoss. We are using standard
> Java (pojo) and Torque for an abstraction to the database. I would like
> to setup a test to demonstrate the abstraction of Torque but I am stuck
> on trying to understand how Torque works together with other components
> to manage connections to the database. From reading I have determined
> that for a dynamic data source JNDI is the way to go, which leads me
> into the problem.
>
> Problem:
> I need the application to switch from using one data source to another.
> For instance, if I am using MSSQL server I would like to be able to
> switch to a mysql server on-the-fly. The times that my application will
> do this is relatively slim, but it's a good test. I would also like to
> store configuration information outside of the application source so
> that it can be configured on multiple deployments with the same source.
>
> What I need from you:
> I don't expect anyone to hack out the code to do this for me or
> something equally as silly. All I really want is some suggestions on how
> do to this, links to resources with things I need to know and perhaps
> explanations of some of the things you had trouble with or think I am
> doing wrong or going about the wrong way. It seems I am really lost on
> how the whole JNDI + Torque + other data source things work together in
> concert, much less how I can use them effectively.
>
> Thanks for reviewing my message, Trey.
>
> ---------------------------------------------------------------------
> 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