see answer from Edson Carlos Ericksson Richter below: -----Original Message----- From: Edson Carlos Ericksson Richter [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 5. M�rz 2002 16:31 To: Paskamp, Marco Subject: RES: Is the JDBC Driver multi thread / servlet safe?
I have several applications that uses JDBC driver, and I had no problems. I make use of tons on connections in Web Apps, Servlets and EJB. The only thing that I make in my code is not share connections between apps. Every method that need to access database uses their own connection, and just before method ends, I close the connection. This works fine with not only SapDB, but Oracle 8i, Sybase System11 and MS SQL Server. Atenciosamente, Edson Carlos Ericksson Richter Gerente de Tecnologia ECONET Solu��es Web +55 61 326 5115 -----Mensagem original----- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Em nome de Paskamp, Marco Enviada em: ter�a-feira, 5 de mar�o de 2002 10:54 Para: 'Martin Smith'; [EMAIL PROTECTED] Assunto: RE: Is the JDBC Driver multi thread / servlet safe? Hello, in general the JDBC-driver is multi thread-safe. But you should not use the same connection object in different threads at the same time, because only some methods in the class ConnectionSapDB are synchronized. We don't synchronize the whole connection object because of the costs for synchronization. Normally a connection pool makes sure that only one application can use the physical connection at a certain time. So, I don't know why different threads should be use the same connection at the same time. Regards, Marco ---------------------------------------------- Marco PASKAMP SAP DB, SAP Labs Berlin > -----Original Message----- > From: Martin Smith [mailto:[EMAIL PROTECTED]] > Sent: Dienstag, 5. M�rz 2002 13:56 > To: [EMAIL PROTECTED] > Subject: Is the JDBC Driver multi thread / servlet safe? > > > All, > > I am having problems with a multi threaded server application > that uses > a pool of connections that can be shared across threads. It appears > that the sapDB JDBC driver connection is not thread safe. The > symptoms > are as follows. If I run a number of server processes I get > database related > errors that disappear if I synchronize the database access code on the > connection being used to retrieve data. code snippet below. > > synchronized(connection) { > resultSet = statement.executeQuery(); > while (resultSet.next()) { > ... > } > } > > Am I correct in thinking that the Connection object > is not thread safe ? > > > > Martin Smith > Beansmith Technologies. > _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.330 / Virus Database: 184 - Release Date: 28/02/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.330 / Virus Database: 184 - Release Date: 28/02/02 _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
