Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 47013 invoked from network); 26 Sep 2003 13:52:29 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 26 Sep 2003 13:52:29 -0000 Received: (qmail 58944 invoked by uid 500); 26 Sep 2003 13:51:39 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 58931 invoked by uid 500); 26 Sep 2003 13:51:39 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 58869 invoked from network); 26 Sep 2003 13:51:39 -0000 Received: from unknown (HELO charon.macalla.com) (213.105.178.163) by daedalus.apache.org with SMTP; 26 Sep 2003 13:51:39 -0000 Received: by CHARON with Internet Mail Service (5.5.2650.21) id ; Fri, 26 Sep 2003 14:51:39 +0100 Message-ID: <10F4BAF24D2FD511B3D600B0D039CEF4F3B7F0@CHARON> From: Ashley Hayes To: 'Apache Torque Users List' Subject: RE: Problem with connections to two data sources Date: Fri, 26 Sep 2003 14:51:38 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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=E9n 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 -----=20 From: "Ashley Hayes" To: "'Apache Torque Users List'" 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=3Dmssql -----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=3Dmssql not sure it will totally fix your problem, A -----Original Message----- From: Fco. Rub=E9n 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=3Ddefault torque.database.default.adapter=3Dmssql ### Jetspeed Microsoft SQL torque.dsfactory.default.connection.driver =3Dcom.microsoft.jdbc.sqlserver.SQLServerDriver torque.dsfactory.default.connection.url =3Djdbc:microsoft:sqlserver://:1433;databaseName=3Ddb1;SelectMethod=3Dcursor torque.dsfactory.default.connection.user =3D **** torque.dsfactory.default.connection.password =3D **** torque.dsfactory.default.factory=3Dorg.apache.torque.dsfactory.TorqueDat= aSourc eFactory # The number of database connections to cache per ConnectionPool = instance torque.dsfactory.default.pool.defaultMaxConnections=3D10 torque.dsfactory.default.pool.maxExpiryTime=3D3600 torque.dsfactory.default.pool.connectionWaitTimeout=3D10 ### The Other Database (db2) torque.dsfactory.db2.connection.driver =3Dcom.microsoft.jdbc.sqlserver.SQLServerDriver torque.dsfactory.db2.connection.url = =3Djdbc:microsoft:sqlserver://:1433;databaseName=3Ddb2;SelectMethod=3Dcursor torque.dsfactory.db2.connection.user =3D **** torque.dsfactory.db2.connection.password =3D **** torque.dsfactory.db2.factory=3Dorg.apache.torque.dsfactory.TorqueDataSou= rceFac tory # The number of database connections to cache per ConnectionPool = instance (specified per database) torque.dsfactory.db2.pool.defaultMaxConnections=3D10 torque.dsfactory.db2.pool.maxExpiryTime=3D3600 torque.dsfactory.db2.pool.connectionWaitTimeout=3D10 ### 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=3DTorque.getConnection("default"); or Connection connDB1=3DTorque.getConnection(); //.... //List rows=3D Tabledb1Peer.doSelect(criteria,connDB1); //... // Conection with db1 ok - i can select rows from db1 connDB1.close(); Connection connDB2=3DTorque.getConnection("db2"); //.... //List rows=3D Tabledb2Peer.doSelect(criteria,connDB2); //... // ERROR:: The conection holds on db1 !!!! and viceversa!! Connection connDB2=3DTorque.getConnection("db2"); //.... //List rows=3D Tabledb2Peer.doSelect(criteria,connDB2); //... // Conection with db2 ok - i can select rows from db2 connDB2.close(); Connection connDB1=3DTorque.getConnection("default"); //.... //List rows=3D Tabledb1Peer.doSelect(criteria,connDB1); //... // ERROR:: The conection holds on db2 ..... What is wrong!?? How can i switch from one connection to other properly = ?=BF?=BF 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