package com.yqzx.generator.config;
|
|
import lombok.Data;
|
import lombok.extern.slf4j.Slf4j;
|
|
import java.sql.Connection;
|
import java.sql.DriverManager;
|
|
/**
|
* @description: 数据库配置
|
* @author: chaoyapeng
|
* @time: 2020/8/18 16:00
|
*/
|
@Data
|
@Slf4j
|
public class DataSourceConfig {
|
|
private String url;
|
|
private String driverName;
|
|
private String username;
|
|
private String password;
|
|
public Connection getConn() {
|
Connection conn = null;
|
try {
|
Class.forName(this.driverName);
|
conn = DriverManager.getConnection(this.url, this.username, this.password);
|
} catch (Exception e) {
|
log.error(e.getMessage());
|
}
|
return conn;
|
}
|
|
}
|