Skip to content

Instantly share code, notes, and snippets.

Avatar
📚

Colby ColbyLeclerc

📚
View GitHub Profile
@ColbyLeclerc
ColbyLeclerc / Main.java
Created Aug 27, 2018
Example using Apache Common's DBCP library
View Main.java
//See https://github.com/ColbyLeclerc/blog-connection-pools/blob/master/src/main/java/Main.java
import database.DBCPDatabase;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Main {
public static void main(String[] args) {
View Connector.java
//See https://github.com/ColbyLeclerc/blog-connection-pools/blob/master/src/main/java/database/DBCPDatabase.java
package database;
import org.apache.commons.dbcp2.BasicDataSource;
import java.sql.SQLException;
public class DBCPDatabase {
private static BasicDataSource dataSource;
//Insert log4j statement
View Connector.java
//See https://github.com/ColbyLeclerc/blog-connection-pools/blob/master/src/main/java/database/Connector.java
package database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Connector {
public Connection getDMConnection() {
You can’t perform that action at this time.