Criei uma classe chamada ConnectionPool da seguinte forma:
package br.com.robson.jdbc;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.hsqldb.jdbc.JDBCPool;
public class ConnectionPool {
private DataSource dataSource;
public ConnectionPool() {
JDBCPool pool = new JDBCPool();
pool.setURL("jdbc:hsqldb:hsql://localhost/loja- virtual");
pool.setUser("SA");
pool.setPassword("");
this.dataSource = pool;
}
public Connection getConnection() throws SQLException {
Connection connection = dataSource.getConnection();
return connection;
}
}
------------------------------------------------------------
Esta dando o seguinte erro : (OBS: O banco está rodando, não está stopado.)
Exception in thread "main" java.lang.NullPointerException at org.hsqldb.DatabaseURL.parseURL(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) at org.hsqldb.jdbc.pool.JDBCPooledDataSource.getPooledConnection(Unknown Source) (<=========== UNKNOWSOURCE ???????) at org.hsqldb.jdbc.JDBCPool.getConnection(Unknown Source) at br.com.robson.jdbc.ConnectionPool.getConnection(ConnectionPool.java:31) at br.com.robson.main.TestaConexao.main(TestaConexao.java:16)
Pergunta: Porque está dando UNkNOWSOURCE ????