is javax.sql.DataSource thread safe?
问题 I am using the PostgreSQL 9.1 JDBC4 driver (postgresql-9.1-902.jdbc4.jar) in a Java EE application deployed in JBoss 7. Can I assume that javax.sql.DataSource is thread-safe so that multiple threads can concurrently call the getConnection() method on it? 回答1: javax.sql.DataSource itself is an interface, so it is a specific to the implentation if it is thread-safe or not. For the postgres sql driver, I recommend that you read Chapter 10. Using the Driver in a Multithreaded or a Servlet