JDBC connection to Virtuoso under LOG4JDBC and DBCP

I started to use Apache DBCP because I stumbled upon this error when I was running thousands of SQL queries. virtuoso.jdbc4.VirtuosoException: Connection failed: Cannot assign requested address THE SOLUTION For initial settings, please check this previous post here DBCP (Database Connection Pools) is described here http://commons.apache.org/proper/commons-dbcp/ I used the library commons-dbcp2 recommended for my Java version java version "1.7.0_72" Java(TM) SE Runtime Environment (build 1.7.0_72-b14) Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode) Next, I changed the class Database described in my previous post in this way a) The simple way import java.sql.Connection; import java.sql.SQLException; import org.apache.commons.dbcp2.BasicDataSource; public final class Database { private static final BasicDataSource dataSource = new BasicDataSource(); static { dataSource.setDriverClassName("virtuoso.jdbc4.Driver"); dataSource.setUrl("jdbc:virtuoso://localhost:1111/"); dataSource.setUsername("dba"); dataSource.setPassword("dba"); } private Database() { // } public static Connection getConnection() throws SQLException { return dataSource.getConnection(); } } b) The way using LOG4JDBC to log SQL queries import java.sql.Connection; import java.sql.SQLException; import org.apache.commons.dbcp2.BasicDataSource; public final class Database { private static final BasicDataSource dataSource = new BasicDataSource(); static { dataSource.setDriverClassName("net.sf.log4jdbc.DriverSpy"); dataSource.setUrl("jdbc:log4jdbc:virtuoso://localhost:1112/"); dataSource.setUsername("dba"); dataSource.setPassword("dba"); } private Database() { // } public static Connection getConnection() throws SQLException { return dataSource.getConnection(); } } I drop my pom.xml here 4.0.0 virtuoso virtuoso 0.0.1-SNAPSHOT src maven-compiler-plugin 3.1 org.apache.jena apache-jena-libs pom 2.13.0 slf4j-log4j12 org.slf4j org.apache.commons commons-collections4 4.0 org.apache.commons commons-lang3 3.3.2 org.apache.commons commons-math3 3.4.1 org.apache.commons commons-csv 1.1 org.slf4j slf4j-log4j12 1.7.16 org.apache.commons commons-dbcp2 2.1.1 org.slf4j slf4j-api 1.7.6 commons-io commons-io 2.4 References http://stackoverflow.com/questions/7592056/am-i-using-jdbc-connection-p…