摘要: 注意:使用xml配置关注 1.1 1.2 1.5使用配置类配置关注 1.1 1.3 1.4 1.51.1 新建jdbc.properties jdbc.driver=com.mysql.jdbc.Driverjdbc.url=jdbc:mysql://localhost:3306/test?serv 阅读全文
posted @ 2021-02-24 14:38 year12 阅读(222) 评论(0) 推荐(0) 编辑
摘要: jdbc.properties 至于resource jdbc.properties 内容如下 jdbc.driver=com.mysql.jdbc.Driverjdbc.url=jdbc:mysql://localhost:3306/testjdbc.username=rootjdbc.passw 阅读全文
posted @ 2021-02-24 13:30 year12 阅读(138) 评论(0) 推荐(0) 编辑
摘要: @Testpublic void test2() throws SQLException{ DruidDataSource dataSource = new DruidDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver 阅读全文
posted @ 2021-02-24 13:18 year12 阅读(153) 评论(0) 推荐(0) 编辑
摘要: @Testpublic void test1(){ /* * c3p0配置Mysql数据源 */ ComboPooledDataSource dataSource = new ComboPooledDataSource(); try { dataSource.setUser("root"); dat 阅读全文
posted @ 2021-02-24 13:14 year12 阅读(97) 评论(0) 推荐(0) 编辑
摘要: getBean 时可以通过class 也可以通过 id<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" //下面这行开启P命名空间 xmlns:p="ht 阅读全文
posted @ 2021-02-24 11:10 year12 阅读(66) 评论(0) 推荐(0) 编辑