Files
projects-jenz/RaceTimer/webproject/src/main/java/DBAcess/DBCPDataSource2.java
T
2019-03-02 15:17:41 +01:00

44 lines
1.3 KiB
Java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package DBAcess;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.dbcp2.BasicDataSource;
/**
*
* @author install1
*/
public class DBCPDataSource2 {
private static BasicDataSource ds = new BasicDataSource();
static {
try {
ds.setDriver(new com.mysql.cj.jdbc.Driver());
//ds.setUrl("jdbc:mysql://151.80.230.149:3306/unloze_stats?useLegacyDatetimeCode=false&serverTimezone=UTC");
ds.setUrl("jdbc:mysql://localhost:3306/unloze_stats?useLegacyDatetimeCode=false&serverTimezone=UTC");
ds.setUsername("unloze_stats");
ds.setPassword("R8J8E9Fzmcc7ZfDAGAk7");
ds.setMaxTotal(-1);
ds.setMinIdle(5);
ds.setMaxIdle(-1);
ds.setMaxOpenPreparedStatements(100);
} catch (SQLException ex) {
Logger.getLogger(DBCPDataSource.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static Connection getConnection() throws SQLException {
return ds.getConnection();
}
private DBCPDataSource2() {
}
}