db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashley Hayes <ashley.ha...@macalla.com>
Subject RE: Problem with connections to two data sources
Date Fri, 26 Sep 2003 13:51:38 GMT
the criteria object uses the a DB for getting the DB Map, so I don't think
you can share the Criteria instance between two queries on different
database connections.
Your example looks like you are trying to share the criteria instance?
try creating two Criteria instances, passing the correct DB name to each
constructor,
e.g. new Criteria ("myDBName")

if this does not help, time to use the debugger...
A


-----Original Message-----
From: Fco. Rubén Calle Aparicio [mailto:ruben.calle@coverlink.com]
Sent: 26 September 2003 12:14
To: Apache Torque Users List
Subject: Re: Problem with connections to two data sources


Thank you, but the problem persists...  :(

R

----- Original Message ----- 
From: "Ashley Hayes" <ashley.hayes@macalla.com>
To: "'Apache Torque Users List'" <torque-user@db.apache.org>
Sent: Friday, September 26, 2003 12:22 PM
Subject: RE: Problem with connections to two data sources


sorry that line should be: torque.database.db2.adapter=mssql

-----Original Message-----
From: Ashley Hayes [mailto:ashley.hayes@macalla.com]
Sent: 26 September 2003 11:21
To: 'Apache Torque Users List'
Subject: RE: Problem with connections to two data sources


your missing the following line,
torque.dsfactory.db2.adapter=mssql

not sure it will totally fix your problem,
A

-----Original Message-----
From: Fco. Rubén Calle Aparicio [mailto:ruben.calle@coverlink.com]
Sent: 26 September 2003 10:46
To: torque-user@db.apache.org
Subject: Problem with connections to two data sources


Hi,

I want to connect to multiple databases using a single
torque.properties.file.
I  have 2 schemas asociated to each database: default_schema.xml and db2_
schema.xml
The databases (db1, db2)  running on SQL Server 2000 in the same machine
My Torque version is Torque 3.0-b3 on Resin 2.1.8
My torque.properties file is like:

### start torque.properties file:
torque.database.default=default
torque.database.default.adapter=mssql

### Jetspeed Microsoft SQL
torque.dsfactory.default.connection.driver
=com.microsoft.jdbc.sqlserver.SQLServerDriver
torque.dsfactory.default.connection.url
=jdbc:microsoft:sqlserver://<DATABASE -
IP>:1433;databaseName=db1;SelectMethod=cursor
torque.dsfactory.default.connection.user =  ****
torque.dsfactory.default.connection.password = ****
torque.dsfactory.default.factory=org.apache.torque.dsfactory.TorqueDataSourc
eFactory

# The number of database connections to cache per ConnectionPool instance
torque.dsfactory.default.pool.defaultMaxConnections=10
torque.dsfactory.default.pool.maxExpiryTime=3600
torque.dsfactory.default.pool.connectionWaitTimeout=10

### The Other Database (db2)
torque.dsfactory.db2.connection.driver
=com.microsoft.jdbc.sqlserver.SQLServerDriver
torque.dsfactory.db2.connection.url =jdbc:microsoft:sqlserver://<DATABASE -
IP>:1433;databaseName=db2;SelectMethod=cursor
torque.dsfactory.db2.connection.user =  ****
torque.dsfactory.db2.connection.password = ****
torque.dsfactory.db2.factory=org.apache.torque.dsfactory.TorqueDataSourceFac
tory

# The number of database connections to cache per ConnectionPool instance
(specified per database)
torque.dsfactory.db2.pool.defaultMaxConnections=10
torque.dsfactory.db2.pool.maxExpiryTime=3600
torque.dsfactory.db2.pool.connectionWaitTimeout=10
### end torque.properties file

The problem is that i can connect to db1 and to db2 BUT not at the same
time, is to say, if i define a connection for db1, i can connect
to db1 without problems but when i try to connect to db2 with ANOTHER
connection Torque uses the old connection (db1 conn); and if i
define a connection for db2, i can connect to db2 without problems but when
i try to connect to db1 with ANOTHER connection Torque uses the old
connection (db2 conn); !?!

The code is:

Connection connDB1=Torque.getConnection("default"); or Connection
connDB1=Torque.getConnection();
//....
//List rows= Tabledb1Peer.doSelect(criteria,connDB1);
//...
// Conection with db1 ok - i can select rows from db1
connDB1.close();

Connection connDB2=Torque.getConnection("db2");
//....
//List rows= Tabledb2Peer.doSelect(criteria,connDB2);
//...
// ERROR:: The conection holds on db1 !!!! and viceversa!!


Connection connDB2=Torque.getConnection("db2");
//....
//List rows= Tabledb2Peer.doSelect(criteria,connDB2);
//...
// Conection with db2 ok - i can select rows from db2

connDB2.close();
Connection connDB1=Torque.getConnection("default");
//....
//List rows= Tabledb1Peer.doSelect(criteria,connDB1);
//...
// ERROR:: The conection holds on db2 .....

What is wrong!?? How can i switch from one connection to other properly ?¿?¿

Thank You Very Much








---------------------------------------------------------------------
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

---------------------------------------------------------------------
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