1 21 package com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl; 22 23 import java.sql.Connection ; 24 import java.sql.SQLException ; 25 26 import javax.sql.DataSource ; 27 28 import org.apache.commons.logging.Log; 29 import org.apache.commons.logging.LogFactory; 30 31 import com.jaspersoft.jasperserver.api.JSException; 32 33 37 public class JdbcDataSourceService extends BaseJdbcDataSource { 38 39 private static final Log log = LogFactory 40 .getLog(JdbcDataSourceService.class); 41 42 private final DataSource dataSource; 43 44 public JdbcDataSourceService(DataSource dataSource) { 45 this.dataSource = dataSource; 46 } 47 48 protected Connection createConnection() { 49 try { 50 return dataSource.getConnection(); 51 } catch (SQLException e) { 52 log.error("Error creating connection.", e); 53 throw new JSException("Error creating connection.", e); 54 } 55 } 56 57 60 public DataSource getDataSource() { 61 return dataSource; 62 } 63 64 } 65 | Popular Tags |