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

Reply via email to