red5连接池

时间:2017-01-12 06:03:50
【文件属性】:

文件名称:red5连接池

文件大小:1.18MB

文件格式:RAR

更新时间:2017-01-12 06:03:50

red5

red5连接池配置: 1,解压jar到项目:WEB-INF\lib目录下 commons-dbcp-1.2.1.jar json-lib-2.4-jdk15.jar mysql-connector-java-5.1.9.jar spring-dao.jar spring-jdbc.jar 2,修改项目目录下的:red5-web.properties 添加:db.driver=com.mysql.jdbc.Driver db.url=jdbc:mysql://localhost:3306/test db.username=root db.password=root 3,修改项目下的:red5-web.xml 添加bean: 4,调用: Object o = scope.getContext().getBean("xbDataSource"); JdbcTemplate t = new JdbcTemplate((BasicDataSource) o); final List l = t.query("SELECT * FROM jt_employee", new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { MappedRow(rs.getInt(1), rs.getString(2)); } }); final Iterator i = l.iterator(); String s = ""; while (i.hasNext()) { System.out.println("------------------------" + i.next().getName()); } 5,自定义javabean: public class MappedRow { protected int id; protected String name; public MappedRow(int _id, String _name) { id = _id; name = _name; } public int getId() { return id; } public String getName() { return name; } }


【文件预览】:
commons-dbcp-1.2.1.jar
spring-dao.jar
mysql-connector-java-5.1.9.jar
spring-jdbc.jar
json-lib-2.4-jdk15.jar

网友评论

  • 看了,学习了,谢谢