DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver"); dataSource.setUrl("jdbc:oracle:thin:@localhost:1521:xe"); dataSource.setUsername("userName"); dataSource.setPassword("pwd");
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@localhost:1521:xe"/> <property name="username" value="userName"/> <property name="password" value="pwd"/> </bean> <!-- DAOS --> <bean id="ProductDAO" class="br.edeploy.voive.dao.ProductDAO"> <property name="dataSource" ref="dataSource"/> </bean>
try { int i = getSimpleJdbcTemplate().queryForInt("Select * from ERP_PRODUCT", ""); } catch(DataAccessException dax) { throw new Exception("Error: "+dax.getMessage()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)