eclipse(maven)与MySQL连接
首先创建与数据库的连接
// An highlighted block
package com.graduation.can.utils;
import org.apache.commons.dbcp2.BasicDataSource;
import javax.sql.DataSource;
public class DbUtils {
private static BasicDataSource dataSource;
static {
dataSource = new BasicDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=utf8");
dataSource.setUsername