List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate
public JdbcTemplate(DataSource dataSource)
From source file:org.pegadi.server.publication.PublicationServerImpl.java
public void setDataSource(DataSource dataSource) { template = new JdbcTemplate(dataSource); }
From source file:com.laxser.blitz.lama.provider.jdbc.JdbcImpl.java
public JdbcImpl(DataSource dataSource) { spring = new JdbcTemplate(dataSource); }
From source file:com.beezas.dao.EventDaoImpl.java
public List getAttendees() { List attendeesList = new ArrayList(); String sql = "select * from attendees"; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); attendeesList = jdbcTemplate.query(sql, new AttendRowMapper()); return attendeesList; }
From source file:com.sfs.dao.BaseDAOImpl.java
/** * Gets the jdbc template writer.// www . jav a 2s . c o m * * @return the jdbc template writer */ protected final JdbcTemplate getJdbcTemplateWriter() { return new JdbcTemplate(dataSourceWriter); }
From source file:ru.org.linux.spring.dao.MsgbaseDao.java
@Autowired public void setDataSource(DataSource dataSource) { jdbcTemplate = new JdbcTemplate(dataSource); namedJdbcTemplate = new NamedParameterJdbcTemplate(dataSource); }
From source file:fr.xebia.xke.test.jdbc.core.SqlScriptProcessor.java
/** * Sets <code>DataSource</code>. */ public void setDataSource(DataSource dataSource) { template = new JdbcTemplate(dataSource); }
From source file:com.anyuan.thomweboss.persistence.JdbcTest.java
public void testConnJdbc() { BasicDataSource datSource = new BasicDataSource(); datSource.setDriverClassName("org.postgresql.Driver"); datSource.setUrl("jdbc:postgresql://127.0.0.1:5432/thomdb"); datSource.setUsername("thomoss"); datSource.setPassword("ossthom"); try {//w ww. j ava 2 s . co m datSource.getConnection(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } JdbcTemplate jdbcTemplate = new JdbcTemplate(datSource); }
From source file:com.rplt.studioMusik.studioMusik.StudioMusikDAO.java
@Override public void deleteData(String pKodeStudio) { String sql = "DELETE FROM studio_musik WHERE kode_studio = ?"; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.update(sql, pKodeStudio); }
From source file:net.solarnetwork.node.dao.jdbc.test.DatabaseSetupTest.java
@Test public void createDatabaseSetup() { DatabaseSetup setup = new DatabaseSetup(); setup.setDataSource(dataSource);/*from w ww . j a v a 2s.c o m*/ setup.setInitSqlResource(new ClassPathResource("derby-init.sql", DatabaseSetup.class)); setup.init(); JdbcOperations jdbcOps = new JdbcTemplate(dataSource); Map<String, ?> results = jdbcOps.queryForMap("SELECT * FROM solarnode.sn_settings WHERE skey = ?", "solarnode.sn_settings.version"); log.debug("Got sn_settings.version record {}", results); assertNotNull(results); assertEquals("Should have key, value, type, flags, and modified values", 5, results.size()); assertEquals("5", results.get("svalue")); }
From source file:com.univocity.articles.databases.Database.java
/** * Initializes this Database object by creating a {@link DataSource} to provide connections to your database. * Tables will be created automatically if required. * * @param tablesToCreate a sequence of table names to create in this database, if they have not been created yet * @param connectionUrl the JDBC URL to use for accessing the {@link java.sql.DriverManager} * @param username the username to connect to the database * @param password the password of the given username, if required *//*from w ww .ja va 2 s .c o m*/ void initialize(String tablesToCreate, String connectionUrl, String username, String password) { try { Class.forName(getDriverClassName()); DataSource dataSource = new SingleConnectionDataSource(connectionUrl, username, password, true); this.jdbcTemplate = new JdbcTemplate(dataSource); } catch (Exception ex) { throw new IllegalStateException( "Error creating database using scripts for database " + getDatabaseName(), ex); } initializeDatabase(tablesToCreate); }