Having problems connecting to an Oracle database

I’m trying to connect to an Oracle database from within Eclipse using Java. Everything (for the most part) should be pretty straightforward, but for some reason, I keep getting errors about “java.lang.ClassCastException”.

My database Java file is as follows:

package Whatever;

import java.sql.DriverManager;
import java.sql.SQLException;
import oracle.jdbc.OracleConnection;

public class DBConnect{
	private String url;
	private String user;
	private String pass;
	public DBConnect(String url, String user, String pass){
		this.url	= url;
		this.user 	= user;
		this.pass 	= pass;
	public OracleConnection main() throws ClassNotFoundException, SQLException{
		Class.forName ("oracle.jdbc.OracleDriver");
		OracleConnection ora_conn = (OracleConnection) DriverManager.getConnection(url, user, pass);
		return ora_conn;
	public void close(){

Are there any immediate / obvious issues with the above? I included the “close” routine because I was receiving errors about it being undefined in the calling class earlier (which may be cause for concern in all this, too).

Any insight is appreciated.

I think I figured out what was going on but it’s somewhat extensive…

The database connection code was okay (or I guess I should say that the database Java file code was okay with the slight mod of renaming “main” to “connection”). The actual connection code itself however is what needed to be changed from within the calling classes.

1.) I needed to adjust some imports of files.
2.) I had to create a new DBConnect object with the authentication details passed into it as parms.
3.) From there, I just needed to reference the actual connection method itself but ensure that the SQLExceptions were being handled correctly.

I don’t have the time at the moment, but if anyone wants a general “template” for what I’m talking about here, just let me know as I now have a functional code base…