Skip to content

Commit

Permalink
Merge pull request #446 from tomjenkinson/JBTM-1938-master
Browse files Browse the repository at this point in the history
JBTM-1938 do not cache the reference to the datasource to provide compat...
  • Loading branch information
tomjenkinson committed Sep 20, 2013
2 parents 741403a + e43cd0b commit 979d81e
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@

public class DataSourceJDBCAccess implements JDBCAccess {

private DataSource dataSource;
private String datasourceName;
private InitialContext context;

public Connection getConnection() throws SQLException {
DataSource dataSource;
try {
dataSource = (DataSource) context.lookup(datasourceName);
} catch (NamingException ex) {
throw new FatalError(toString() + " : " + ex, ex);
}
Connection connection = dataSource.getConnection();
connection.setAutoCommit(false);
return connection;
Expand All @@ -71,8 +77,7 @@ public void initialise(StringTokenizer tokenizer) {
}

try {
InitialContext context = new InitialContext();
dataSource = (DataSource) context.lookup(datasourceName);
context = new InitialContext();
} catch (NamingException ex) {
throw new FatalError(toString() + " : " + ex, ex);
}
Expand Down

0 comments on commit 979d81e

Please sign in to comment.