DataSource Cannot Resolve Symbol Problem
843835Nov 21 2002 — edited Nov 21 2002Hello Everyone. I've developed a JSP application from the Wrox JSP Web development book. I've created a Database Connection Pool Servlet file. When I try to compile this file, I get the following error:
com\wrox\tourism\db\util\ConnectionPool.java:5: cannot resolve symbol
symbol : class DataSource
location: package sql
import javax.sql.DataSource;
^
com\wrox\tourism\db\util\ConnectionPool.java:9: cannot resolve symbol
symbol : class DataSource
location: class com.wrox.tourism.db.util.ConnectionPool
private DataSource ds;
^
com\wrox\tourism\db\util\ConnectionPool.java:13: cannot resolve symbol
symbol : class DataSource
location: class com.wrox.tourism.db.util.ConnectionPool
private ConnectionPool(DataSource ds) {
^
com\wrox\tourism\db\util\ConnectionPool.java:17: cannot resolve symbol
symbol : class DataSource
location: class com.wrox.tourism.db.util.ConnectionPool
public static void init(DataSource ds) {
The Connection Pool file is as follows:
package com.wrox.tourism.db.util;
import java.sql.SQLException;
import java.sql.Connection;
import javax.sql.DataSource;
public class ConnectionPool {
private DataSource ds;
private static ConnectionPool mySelf;
private ConnectionPool(DataSource ds) {
this.ds = ds;
}
public static void init(DataSource ds) {
mySelf = new ConnectionPool(ds);
}
public static ConnectionPool getInstance() {
if (mySelf == null) {
throw new IllegalStateException("Pool not initialized.");
}
return mySelf;
}
public Connection getConnection() throws SQLException {
return ds.getConnection();
}
}
Could anyone help me out as I'm completely lost!!!
Much appreciated,
Assad