Search in sources :

Example 21 with DataSource

use of org.apache.tomcat.jdbc.pool.DataSource in project ocvn by devgateway.

the class DatabaseConfiguration method dataSource.

/**
     * Creates a {@link javax.sql.DataSource} based on Tomcat {@link DataSource}
     * 
     * @return
     */
@Bean
@DependsOn(value = { "derbyServer" })
public DataSource dataSource() {
    PoolProperties pp = new PoolProperties();
    pp.setJmxEnabled(true);
    pp.setDefaultTransactionIsolation(springDatasourceTransactionIsolation);
    pp.setInitialSize(springDatasourceInitialSize);
    pp.setMaxActive(springDatasourceMaxActive);
    DataSource dataSource = new DataSource(pp);
    dataSource.setUrl(springDatasourceUrl);
    dataSource.setUsername(springDatasourceUsername);
    dataSource.setPassword(springDatasourcePassword);
    dataSource.setDriverClassName(springDatasourceDriverClassName);
    return dataSource;
}
Also used : PoolProperties(org.apache.tomcat.jdbc.pool.PoolProperties) DataSource(org.apache.tomcat.jdbc.pool.DataSource) DependsOn(org.springframework.context.annotation.DependsOn) Bean(org.springframework.context.annotation.Bean)

Aggregations

DataSource (org.apache.tomcat.jdbc.pool.DataSource)21 PoolProperties (org.apache.tomcat.jdbc.pool.PoolProperties)8 Test (org.junit.Test)8 Connection (java.sql.Connection)5 SQLException (java.sql.SQLException)5 DefaultProperties (org.apache.tomcat.jdbc.test.DefaultProperties)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 GargoyleException (com.kyj.fx.voeditor.visual.exceptions.GargoyleException)2 NotSupportException (com.kyj.fx.voeditor.visual.exceptions.NotSupportException)2 ResultSet (java.sql.ResultSet)2 Statement (java.sql.Statement)2 PoolConfiguration (org.apache.tomcat.jdbc.pool.PoolConfiguration)2 BeanSerializerFactory (com.fasterxml.jackson.databind.ser.BeanSerializerFactory)1 SerializerFactory (com.fasterxml.jackson.databind.ser.SerializerFactory)1 GargoyleConnectionFailException (com.kyj.fx.voeditor.visual.exceptions.GargoyleConnectionFailException)1 ScriptRunner (com.linkedin.thirdeye.datalayer.ScriptRunner)1 FileReader (java.io.FileReader)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1