Hi,

I'm doing a project where I need to use a postgres database, and I'm trying to connect to the database but apparently the driver is not visible to the project. This is an extremely weird problem, because I had previously configured another project just like the one I'm doing now as an example, and it could connect to the database using almost the exact same code. I have tried going to Project->Properties->Java Build Path->Libraries->Add External Jar and also Project->Properties->Java Build Path->Libraries->Add External Library to load the jdbc connector .jar, which worked the first time in the example project but will not work on my current project. I am totally stumped; I even tried modifying the MANIFEST.MF file to manually include the .jar in the classpath (by writing the location of the file there). Nothing has worked so far.

Here's my DataSource file, which makes the connection to the database. The problem seems to be line 15; it can't seem to find the driver.
Java Code:
package dbproject.classes;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DataSource {
	private static DataSource singleton = null;
	private String userName;
	private String password;
	private String dbName;
	
	private DataSource(String userName, String password, String dbName) 
			throws ClassNotFoundException {
		Class.forName("org.postgresql.Driver");
		this.userName = userName;
		this.password = password;
		this.dbName = dbName;
	}
	
	public static DataSource getInstance() throws ClassNotFoundException {
		if (singleton == null){
			singleton = new DataSource("postgres", "albertino16", "dbproject_OfficeSuppliesDB");
		}
		return singleton;
	}
	
	public Connection getJDBCConnection() throws SQLException{
		String dbURL = "jdbc:postgresql://localhost:5432/" + this.dbName;
		Connection dbConn = DriverManager.getConnection(dbURL, userName, password);
		return dbConn;
	}
}

I would really appreciate if anyone could help me out!
Tino